On Tue, Jan 25, 2011 at 9:33 AM, mikeee <mike.engelh...@gmail.com> wrote: > Also, Mark you said that the OS is probably terminating the service > because it has acquired an everlasting wake lock.
I meant that the OS is probably terminating the service because it is everlasting, not specifically the WakeLock. This has been discussed on this list several times -- Android is being more aggressive about killing off background services because too many developers have been starting services and leaving them running for no good reason, tying up memory and irritating users. This is what led to the rise of the task killer app, the Manage Services screen in the Settings app, etc. > I'm not sure what switching to a timer approach that has to wake up > every 15 seconds or less and then wait to acquire a GPS lock (which > itself can take 15 seconds if you have to do it from scratch each time > the phone wakes up), update the database in my app and then let the > default sleep timeout come and go. I don't think the phone would ever > sleep in that scenario if your phone sleep time was 15 seconds for > example. I agree if I only needed to wake the phone up every 5 > minutes to do a task then an Alarm based system would make sense. If your app is designed to be used for short periods this way (you cite Google Navigation as an exemplar), keeping the device awake and the GPS on for those periods, when a user has explicitly and visibly asked for it, and where the user is aware of what you are doing (e.g., startForeground(), as Ms. Hackborn mentioned), can be OK. For example, a user is unlikely to miss the fact that Google Navigation is keeping the device awake and GPS on, considering it is showing the user the road ahead whenever the screen is on, not to mention the blue arrow notification icon in the status bar. Now, I admit, I jumped to conclusions based upon your stated symptoms -- the conclusion being that you are trying to run this service beyond short periods. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in London: http://bit.ly/smand1 and http://bit.ly/smand2 -- 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