I am using phone gap to develop an android app. Is it possible to check if the app is running in background or foreground using javascript?
As we can close the app by calling navigator.app.exitApp()
. We can perform other functions as well.
Is there any function which can tell us whether the app is running in background or foreground?
Actually, I want to make the app working in following way.
If app is in foreground, it should show an alert message rather than a push notification.
If app is in background it should show a push notification.
Many thanks Indeed.