Note that there are some explanatory texts on larger screens.

plurals
  1. PORemote service killed while main process bound to it
    text
    copied!<p>On my Galaxy Nexus with Jelly Bean 4.1.1 (official) sometimes the OS goes on a killing spree and the log has these kinds of entries:</p> <pre><code>10-02 22:24:34.992 I/ActivityManager( 306): Killing 7517:com.google.android.apps.reader/u0a77: remove task 10-02 22:24:36.484 I/ActivityManager( 306): Killing 7465:com.tf.thinkdroid.sg:writedroid/u0a50: remove task 10-02 22:24:37.273 I/ActivityManager( 306): Killing 5924:com.metago.astro/u0a73: remove task 10-02 22:24:37.296 W/ActivityManager( 306): Scheduling restart of crashed service com.metago.astro/.jobs.JobService in 5000ms 10-02 22:24:37.656 I/ActivityManager( 306): Killing 7302:org.jtb.alogcat/u0a84: remove task 10-02 22:24:38.148 I/ActivityManager( 306): Killing 7120:com.google.android.gm/u0a19: remove task </code></pre> <p>Unfortunately one of the processes being killed is my remote service that has a running app bound to it. Indeed, the service is restarted immediately afterwards but this causes inconsistent behavior in my app.</p> <p>In <a href="https://developer.android.com/reference/android/app/Service.html#ServiceLifecycle" rel="nofollow">Service Lifecycle</a> it says:</p> <blockquote> <p>A service can be both started and have connections bound to it. In such a case, the system will keep the service running as long as either it is started or there are one or more connections to it with the Context.BIND_AUTO_CREATE flag.</p> </blockquote> <p>My app binds to the remote service with <code>Context.BIND_AUTO_CREATE</code> so I was under the impression that the remote service will stay up as long as the main process is bound to it. How can I make Android not kill the remote service?</p> <p>NOTE: The bounty is for explaining why the code doesn't seem to work according to the documentation.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload