On Fri, Aug 10, 2012 at 12:17 AM, Johan Appelgren <[email protected] > wrote:
> Still occupies some amount of memory though, and the service's onCreate > might not be cheap. I'm not sure what this means...? If you are concerned about the service having too much overhead because you have bound to it and it doesn't need to run just while bound, don't use BIND_AUTO_CREATE. > Anyways, I guess this is one of those little undocumented things you just > have to learn. Do not rely on START_NOT_STICKY if you both start and bind > to a service if you don't want the service to stay around forever as a > cached process after you've unbound it. > Honestly I think it is pretty fully documented. But maybe we have a misunderstanding -- once you unbind from the service, the fact that you had previously bound to it has no further impact on how it is handled, and if its process is killed after that it will not be restarted. As long as you are bound to it with BIND_AUTO_CREATE, the system will try to keep it created and if the process is killed while you remain bound to it then it will try to restart it. As long as the service is in the started state, the system will try to keep it created/started, and if the process is killed then it will be restarted if it is not sticky. The decision about whether to restart the service is if either of those conditions result in it wanting to restart it. Again starting and binding are orthogonal to each other. You just have to know how each works individually, and what happens in the service is based on whether either of them drive it to need to be created. As I think is covered pretty fully in the documentation. -- 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

