On Wed, Nov 18, 2009 at 12:18 PM, jotobjects <[email protected]> wrote:
> If the system is slow due to CPU contention then an Activity running > in the background would also be part of the problem. If the system is > low on memory the System can also kill Services. But I get it that > too many Services thrashing has been the bigger problem. > Again: as of 1.6, this will not happen, because background processes are put in a scheduling class that only allows all processes, together, to get no more than 5% or so of the CPU. > > The new running services UI > > -only- stops a service, doesn't kill a process or anything else, because > > that is all that is needed to free up that process to be available to the > > system. > So applications need to be coded to restart their own Services. It's > even possible that the app's Activities are still running threads in > the background but the Services have been stopped. > If the user has decided that your application's service(s) are not desired, they get to stop them. You should probably consider how to recover from this. Implementing your app so it starts a service at boot and leaves it running forever is much more likely to get you in this situation, because this is the kind of thing that cause the system to start thrashing, and your service is going to be an obvious target for people wanting to stop things. And IMHO this is as it should be. As far as activities running threads -- as always, if your activity creates threads, and then goes in the background, be prepared to have your process killed at any time while they are running. If you have work to do that you want to have a better chance of keeping around, associate it with a service. Then of course the user may decide to stop the service, at which point you will get onDestroy() called. -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. 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 [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

