Phonegap pause event
Pause event
Similar to android's life cycle pause code function, it is called when the current application is about to switch to the background (similar to clicking home Jian and returning to the desktop)
You can use a pause event to save data.
The application should use document. addEventListener to load
Simple Example:
document.addEventListener("pause", onPause, false);function onPause() { // Handle the pause event}
Complete example:
Pause Example<Script type = "text/javascript" charset = "UTF-8" src = "cordova. js "> </script> <script type =" text/javascript "charset =" UTF-8 "> // Wait for device API libraries to load // function onLoad () {document. addEventListener ("deviceready", onDeviceReady, false);} // device APIs are available // function onDeviceReady () {document. addEventListener ("pause", onPause, false);} // Handle the pause event // function onPause () {// onpause execution} </script>
Supported systems:
Amazon Fire OSAndroidBlackBerry 10 iOSWindows Phone 7 and 8 Windows 8
Ios usage problems:
Http://docs.phonegap.com/en/3.4.0/cordova_events_events.md.html#pause