title: How to prevent a user from stopping an Android service?
body: <p>I created an Android app and need to make it difficult for users to stop the main service that the app spawns during its startup process.  This is for a rooted Jelly Bean 4.1.2 device.  Here are some steps I've taken so far:</p>
  
  <ul>
  <li>Installed as System App</li>
  <li>Uses the Device Admin APIs</li>
  <li><code>android:allowClearUserData="false"</code> is included in the AndroidManifest.</li>
  </ul>
  
  <p>The steps I've taken so far takes care of <em>most normal ways</em> a user would stop/disable an app/process; however, when you check the running apps list in Settings -> Application manager -> Running, users can still hit the 'Stop' button on the long-running service that was started by the app (see picture below):</p>
  
  <p><img src="https://i.stack.imgur.com/1I26x.png" alt="Service from Running Apps"></p>
  
  <p>Is there any way to prevent users from stopping the service here?  Or what's the best way to restart a service when a user hits this stop button?  I tried putting some code in the service's onDisable() function, but that function does not seem to be called in this case.</p>
  
  <p>Any help would be appreciated!</p>