-
-
Save PRINCEHR/efe2dbe9f3b575b2ca9e899eaa737e3c to your computer and use it in GitHub Desktop.
Cordova Exit App Confirm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("deviceready", deviceisready, false); | |
function deviceisready(){ | |
alert("Device Ready is called"); | |
document.addEventListener("backbutton", function(e){ | |
if ( $('.ui-page-active').attr('id') == 'mainpage') { | |
//window.location = "#exitDialog"; | |
exitAppPopup(); | |
}else{ | |
history.back(); | |
}; | |
}); | |
}; | |
function exitAppPopup() { | |
navigator.notification.confirm( | |
"Do you really want to close this app?", | |
function(buttonIndex){ | |
ConfirmExit(buttonIndex); | |
}, | |
"Confirmation", | |
"Yes,No" | |
); | |
alert("Outside Notification"); | |
//return false; | |
}; | |
function ConfirmExit(stat){ | |
alert("Inside ConfirmExit"); | |
if(stat == "1"){ | |
navigator.app.exitApp(); | |
}else{ | |
return; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank You