Let me put it this way..
If a user swipes away my app to close it, I want to detect that swipe as an exit.
We are all aware of how to tap the application listing key on a phone to display all running apps and then swipe away whichever app you wish to close.
Or even tap the close all key...
This is where I want to intercept the closure of my app and stop my service.
Any help guys?
and
starting the service at normal start and OnResume
If that doesn't fit your requirements, you might have to poll regularly from the service and shut down if you don't get a response from the app
It is possible to write code for the service to check directly whether the main app is running but the code is not obvious.