title: Stopped Foreground Service Restarting Itself
body: <p>I have a foreground service in which I register for location updates, and intent filter for the battery intent <code>Intent.ACTION_BATTERY_CHANGED</code>, and a <code>LocalBroadcast</code>. All of these I remove in the <code>onDestroy</code> of my service as once this service is dead.</p>
  
  <p>I also have changed the return integer in the <code>onStartCommand</code> from <code>START_STICKY</code> to <code>START_NOT_STICKY</code> but this has no effect.</p>
  
  <p>I log when this service is started and destroyed as well as my main activity and it seems that this service just starts on its own without any activities.</p>
  
  <p>The issue is it's a foreground service so a notification accompanies it. This means that when it's started up again randomly, the user sees the notification and I don't want the service to be running on its own accord.</p>
  
  <p>So to recap.<br>
   - It is a bound, foreground service.<br>
   - I return <code>START_NOT_STICKY</code> in <code>onStartCommand</code><br>
   - When I no longer need it and close the app, I unbind from it, call stopService and the service's onDestroy is called which is where we unregister all of the receivers.
   - The service is randomly started after this.</p>