I'd like to create a service for Android that performs an operation once a day at a given time. What's an efficient way to accomplish this - I want to make sure I'm not draining the device battery since this service is idle 99% of the time.
+7
A:
Not an Android expert, but http://www.androidguys.com/2009/04/02/wake-up-with-the-alarm/ seems to be what you are looking for
chburd
2009-12-29 15:35:19
Agreed, and not just because I wrote that article. :-) AlarmManager will let you schedule work so your code can behave more like a cron job or Windows scheduled task -- wake up, run for a bit, then stop. Be sure to use a WakeLock so the device stays awake while you're trying to get work done. You can see a sample project implementing all of that here: http://github.com/commonsguy/cw-advandroid/tree/master/SystemServices/Alarm/
CommonsWare
2009-12-29 15:39:13
Great stuff, will use it!
James Cadd
2009-12-29 15:43:40