> I wanted to ask a question regarding the Alarm Manager. I have a > requirements of setting long running timers in my application. The minimum > duration for my timer is 1 hour...and the maximum may be for 4-5 days. > This > timer is supposed to run in the background, and when it fires/expires, i > have to show something on the GUI.
Your "GUI" is probably not running when the alarm will go off. > What is the best approach for scheduling such long running timers ? > > Should i make use of the Alarm Manager ? Or will it be an overkill ? AlarmManager is the only viable choice for something of that duration. > I am thinking of using a simple Java TimerTask as an alternative to > setting > an alarm: > http://java.sun.com/j2se/1.5.0/docs/api/java/util/TimerTask.html. That will only work if the user is keeping your application running all of the time, and that is unlikely to be the case. > But i am not sure what will happen to the timer task if the device went to > sleep while the task was running. TimerTask does not wake up the device. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Books: http://commonsware.com/books.html
-- 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