I have noticed most apps follow the pattern of starting and binding to
their services during an activity's onCreate, and similarly unbinding
during onDestroy.   From my understanding, this means that if the user
enters an activity with a transient service, but then leaves the
activity using the Home key (and not Back), the service will remain
connected even after stopSelf is called to indicate that the service
is no longer busy.

The implication of this is that the process hosting the service will
have an oom_adj of 2, leaving it much less likely to be reaped by the
out-of-memory killer even in the event that the service isn't busy
doing anything.

I tested this against the Music app in particular, and it is subject
to this problem.  Leaving the app with the home key will leave the
process active with oom_adj=2, even without music playing.

I have adjusted my application to bind/unbind during onStart/onStop
which is the only work-around to this that I know of.  In practice,
the performance does not seem to be much different.
--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to