Working on a mobile application using jquery mobile and phonegap framework. My question is rather basic – How would you tap into application closing events. Scenario – When a user clicks the close app button if the application is in the middle of some processing I would like to do some cleanup – example write some status codes to a file. My app cannot do a clean exit. Is there an event for app closing that we could tap into either in phonegap or jquery?
I could see references on how to exit an app but nothing on tapping an event fired when someone closes an app.
Currently working on a blackberry application using phonegap/jquery mobile.
EDIT
For the blackberry we could use
blackberry.system.event.onHardwareKey(blackberry.system.event.KEY_BACK,
function() {
alert('back button pressed');
});
However, I am not sure if what to use to close the app after handling the event consistently on all Blackberry phones.
navigator.app.exitApp() or
device.exitApp()
See phonegap api -> events -> pause: