I have an application built in html5 and phonegap for android, by pressing the exit button I call the following function(JavaScript):
function close_window() {
if (confirm("Exit?")) {
navigator.app.exitApp()
}
}
Window with the message "Exit?" appear, but the application does not close when you click OK, how can we close it?
Is this the way to use navigator.app.exitApp()?
I think your missing with call of confirm
notification.
Please try following code, it is working fine in my app:
document.addEventListener("exitButton", function(){
navigator.notification.confirm(
'Do you want to quit',
onConfirmQuit,
'QUIT TITLE',
'OK,Cancel'
);
}, true);
function onConfirmQuit(button){
if(button == "1"){
navigator.app.exitApp();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With