I have an observation concerning how Android handles scheduled events and would like any suggestions, comments, or feedback on how other developers have handled this behavior in Android.
I have noticed that there does not appear to be anyway to schedule an event to happen at "regularly" scheduled times. By regularly scheduled times I mean a long-lived service/schedule that must run every "n" minutes. For instance, an application that must check the status of a web service at user specified intervals (like every 10 minutes). I have tried a writing a service to run in the background using Context.startService, Android stops that service after a few minutes. And, there are many senior Android developers that recommend using the "alarm that starts a service" method for this type of application. My testing on Context.StartService would tend to agree. My best results have been using an alarm to start a service, although the results are still less than stellar. I have done weeks of testing trying to get Android to run a service every 10 minutes (or even close to 10 minutes) using the "Alarm that starts a service" method. The best I can get in a 24 our period for an alarm scheduled every 10 miutes is about 75% (110 out of 144 repeating alarms). I have tried varying this interval from 1 minute to 30 minutes with the same result. I have tested on a non-rooted T-Mobile both 1.0 and 1.1 firmware. I have tested on an ADP using both 1.0 and 1.1 firmware. I have tried using "PARTIAL_WAKE_LOCK" and "FULL_WAKE_LOCK" feature of the PowerManager. Nothing seems to work. Android just will not run an event consistently. I had high hopes for the repeating alarm that starts a service, but it seems Android always skips many of the scheduled alarms. I am beginning to think that "Reguarly" scheduled events is not even possible in Android. I'm looking for any comments and suggestions from developers and Android engineers. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

