When user goes to other apps from my app or presses device home button from my app or etc , then my app will be sent to background. And in the background am doing some stuff . So how to know is my app has gone to background . One solution will be to check if any of app activities are in onstart,onrestart,onresume,onpause,onstop if not then we can consider it in background. But this solution is tedious please help me if you have a easy solution
Share
Using
onPauseisn’t tedious, and may be your only solution anyway. Create an abstractActivityclass that all yourActivityclasses extend and do whatever you need to do inonPausethere:Using this example, all your
Activityclasses should now extendBaseActivity.