I have an app with a background service. I am using the service to play sound in background. Problem is, is when you close the app manually, the service keeps playing sound in background. I have the service set to start every 10s and audibly play sound every 10s. The service schedules itself every 10s so , when the main activity is closed the service still goes on rescheduling. and yes i have watched the app life cycle tutorial.
@Peter Simpson that does work to kill the service but, I need to kill the service when the main activity is killed unexpectedly.
because i need the service to still run if the home button is pressed.
Usually pressing back key twice should close the main activity and the app.
I have a radio streaming app which plays in the background with whena service you press the home button, but it has a notification icon which you can press to bring the main activity up and then close with back button.
my concern is when the user opens the task chooser and quits app, my service stays running using data and other resources. I want to be able to catch the quit and close out the service.