AuxOne wrote: > I've successfully implemented a BootReceiver, AlarmManager, and > Service per the code here: > http://github.com/commonsguy/cw-advandroid/tree/master/SystemServices/Alarm > > Inside the doWakefulWork method of the Service I am instantiating a > few classes, but some of them require my Activity to be running.
On the whole, that's not a good idea. Popping up an Activity in the middle of whatever the user is doing will not be popular. There are certain circumstances where this is appropriate -- incoming VOIP calls, etc. -- but should not be done in general. Users will attack you with sharp pointy things. > How > do I actually start the Activity? The code above only starts the > AlarmManager and Service. startActivity() from some Context (e.g., the Service). > And what about the situation where the user first installs your > application and may not even reboot their phone for a week. In that > case, do you have to start the Service from the Activity? Probably not. You probably schedule your alarm from the Activity. So, on first run, you set up your alarm when the user fires off the Activity for the first time. After that, you let the BOOT_COMPLETED receiver handle scheduling the alarms. The hole in this plan is dealing with "task killers", since they wipe out alarms along with shutting down any bits that were in memory. I don't have a good solution for that. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Training: http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.