Search code examples
androidbackground-processonresumeonpause

Check if my app is launched from background or not in android?


Suppose if I am using my android app and I click on home button in say xyz activity. Now at this point the app is running in background, now if the app is launched again the xyz activity will be brought to front that is fine but I want to check if the app is called from background or now. I have some confusion if it has to do something with onResume() method but dont know the exact solution. Anyone please help me with this topic.


Solution

  • Please, read this article. If you create activity you will pass through onCreate -> onStart -> onResume, and if you returns to activity you will pass onRestart -> onStart -> onResume.