sleith wrote: > Hi, > wanna ask again about Mark's first warning: > " Your service will not be running for very long once the screen turns > off. The phone will go to sleep, and your service will stop running > when > the phone turns off the CPU. " > > when the phone turns on the CPU again, will the service restarted > automatically?
"Restarted"? A running service will start running again, but to me "restart" implies it was destroyed and recreated, which does not happen. When the CPU shuts down, everything freezes in mid-operation. When the CPU starts up again, everything continues from where it was. Again, I strongly advise against having services run indefinitely. A well-constructed service only runs when it needs to (via an alarm) and can arrange via a WakeLock to keep the CPU running for the short period it needs to run. See more at: http://www.androidguys.com/2009/09/09/diamonds-are-forever-services-are-not/ -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

