Wednesday, June 15, 2011

[android-developers] When should I leave a service running?

I'm trying to understand the lifecycle of services. What I don't quite get is when should I ensure my service is stopped when done with its work and when should I just leave it running in case it is needed again. Is there a cost to starting a service? If I know that my service will do things once per hour for example, is it best to stop it in between or should I leave it running? 

Looking at other apps it would seem starting a service is expensive and that I should basically always leave it running. From the looks of it that is what Google Maps, Google Music, Email, Spotify, DoggCatcher, Google Listen and more does at least. 

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment