exit button event in phonegap for iOS?

梦想的初衷 提交于 2019-12-13 15:04:52

问题


is there any event Listener that calls when we press on iPhone close button in phonegap?

so that we can do final task when application close.

i have found that onunload method will call when webpage redirect but it want work here.

please help me.


回答1:


Under the PhoneGapDelegate.m class, you have the applicationDidEnterBackground method, replacing from iOS 4+ the applicationWillTerminate method for applications supporting background execution.




回答2:


You can listen to Phonegap's "pause" event:

document.addEventListener("pause", yourCallbackFunction, false);

http://docs.phonegap.com/en/2.9.0/cordova_events_events.md.html#pause



来源:https://stackoverflow.com/questions/18931722/exit-button-event-in-phonegap-for-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!