Although we want our users to spend their time solely on our application, they will inevitably leave our application to open another one or do something else entirely. We need to be able to detect when a user has left our application but not closed it down entirely.
We can use the PhoneGap API to fire off a particular event when our application is in the background of the device:
pausedemoby running the following command:
phonegap create pausedemo com.myapp.pausedemo pausedemo
cordova platform add ios cordova platform add android
www/index.htmland let's clean up unnecessary elements. So ...