How to use navigator.app.exitApp()?
android, cordova, html, javascript
Solution
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();
}
}
Problem
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()?