I'm developing an application for Android using phonegap, I have to push back button twice for the app to exit, is this phonegap default behavior? I can add a listener to backbutton and force the app to exit from first push to backbutton as a workaround but would this solve it ?
0
votes
1 Answers
1
votes
No, this is no normal behaviour. The backbutton will be available when deviceready event was fired. E.g.
function onDeviceReady(){
document.addEventListener("backbutton", function(e){
if($.mobile.activePage.is('#homepage')){
e.preventDefault();
navigator.app.exitApp();
}
else {
navigator.app.backHistory()
}
}, false);
}
backbutton http://docs.phonegap.com/en/edge/cordova_events_events.md.html#backbutton deviceready http://docs.phonegap.com/en/edge/cordova_events_events.md.html#deviceready