Android Question Background Music Not Stopping

Mohamed Akbarally

Member
Licensed User
Hi, I'm running some background music through a service, but the only problem is that when the app is exited(running in completely in the background) the music continues to play. Is there a way to kill the music when there are no activities visible?
 

NJDude

Expert
Licensed User
Then on the Main activity capture the BACK key and ask if the user wants to exit the app, if yes, then kill the service as it exits.
 

NJDude

Expert
Licensed User
Ok here's the deal, services run in the background, so, you will have to find a way to stop them, in this case, by exiting the app (like I explained previously), the HOME key cannot be captured but it will pause the app, so in conclusion, you can only stop the music playing IF the user EXITS the app.
 

Mohamed Akbarally

Member
Licensed User
Ok here's the deal, services run in the background, so, you will have to find a way to stop them, in this case, by exiting the app (like I explained previously), the HOME key cannot be captured but it will pause the app, so in conclusion, you can only stop the music playing IF the user EXITS the app.
OK then forget services, is there any possible way to implement background music into an application that runs seamlessly across multiple activities, and closes at exit? there must be some way, how do other apps do it?
 
Top