The alarm manager would probably be overkill for that. It might make more sense to do this in a Service, which holds a partial wake lock to keep itself running. Note that this will have a noticeably impact on battery life because you are preventing the CPU from going to sleep, though I can't tell you exactly how much.
On Fri, Jan 23, 2009 at 2:01 PM, John Bohumil <jbohu...@gmail.com> wrote: > Finally, for something like a countdown timer, you really might want to >> consider using the alarm manager so you don't need to keep your app running >> at all while it is in the background. That is the kind of thing a well >> behaving Android app will do. To be able to show the remaining time if the >> user returns to your activity, you can store on SharedPreferences the time >> the countdown was started. >> >> Using the alarm manager is also the only way you can make sure you execute >> when the time expires, even if the user has turned off the phone. >> > As it happens I am writting a countdown timer that implements a repeating > notification at quite short interface. For example the application might > chirp every 10 seconds. This is used for certain breathing excercises where > you hold the breath for 10 seconds, breathe out for 10 seconds, in for 10 > seconds etc. > > For such short intervals would I still be better off using the alarm > manager? The handler technique seems to work great for my purposes but I > want to make sure I write a well behaved app. > > John > > > > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---