I have a very simple Android GPS logging app that runs a service. The Activity is nothing but a start/stop button to control the service. On a button click, I start a new background service (with START_STICKY). Then I close the Activity and the service runs normally. I can run the app again to stop the service.
The service simply logs GPS coordinates to file. I am Logging in every method and Exception catch. At some point, could be minutes or hours, my service will stop, but onDestroy is not called and no exceptions are thrown. The logs simply show my last file write worked and then nothing. I suspect GC is killing it, but I thought START_STICKY basically meant "please run me as long as possible". 30 seconds later, a new copy of the service is started (different PID), onCreate and onStartService are called as usual.
Will Android kill a service if/when it kills its parent Activity or Application? Is it necessary to run the service in a separate thread to prevent this? Why would the full service life-cycle not complete (onDestroy is not called)?