I've created a non self-terminating intent service by extending IntentService as suggested here: Can an IntentService run indefinitely?
A consequence of this is that if my app crashes my service could still be running the next time I start the MainActivity. Is there a recommended way to determine if an arbitrary service is running?
I've seen solutions recommend I set a flag in the onCreate and onDestroy methods of the service, but a service can end without onDestroy being invoked (for example if it crashes) so that's not a perfect solution.