On Thu, Jun 10, 2010 at 7:20 PM, Mark Murphy <mmur...@commonsware.com>wrote: > > Generally speaking, your goal is to not have your code run and not have > your code be in memory. The more your code runs, the more battery you > consume. The more memory you take up, the more difficult it is for other > applications to run. And, as Ms. Hackborn mentioned, your service will > eventually be destroyed, anyway. > > The best way to do polling operations in Android is to use the > AlarmManager and an IntentService. However, that does not work well with > interfaces where you have to register listeners, such as SensorManager. > > I'm restructuring my app now to get rid of my persistent service. Initially due to users asking for the notification icon to be removed, followed by my own desire to get out of RAM, then reading Mark's articles.
I have the onBoot receiver schedule the alarmManager. How do you schedule the alarm prior to the first boot? I could schedule it on activity launch, but it would do it for every launch - even after it successfully scheduled on a boot. My initial idea is a preference for first run, so I know I'd need to schedule it. But that would be destroyed by a task killer. The other idea is a last run date that the activity could check but that would be vulnerable to race conditions. Am I missing the "list alarms" method? Thanks -- 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