Android: Check application is running foreground?


1. QA1:

Android has different application lifecycle, Many times user press Home hardware button and application goes in background, Application is still running but it’s in background, Now We want to identify that application is running in background or not. It require when we don’t want to create new instance of Activity. Android SDK provide class named ActivityManager. Using ActivityManager we can check application is running in background.

2. QA2