I have a service class that is not bound to any activity. Inside of this service class I am putting a few unfinished audio player components. and there is a Broadcast Receiver there in the from of an anonymous inner class.
there are 5 activities in the application. How do I keep this background Service class alive while the user is navigating between the 5 activity screens. but kill the service if they navigate outside of these 5? Like if they leave and look at a different pornography application?
one idea I read about is to bind the service in the onResume() of each Activity and un-bind it in the onPause() of each of the 5 activities.
What is the best way to do this?
Each application can also have an
Applicationclass.You might want to bind from there and keep track of which activity is open.