I have created one application in which I want to start service when application comes to background and stop service when application is in foreground.
I used onPause() and onResume(), but i have to handle it in every activity. So, it’s called when i move from one activity to another activity.
I have created one application in which I want to start service when application
Share
Create a “base”
Activity…Then simply extend your base
Activityfor all of theActivityclasses you create…In this way all of your
Activitieswill automatically handle what you need to do.