Instant app exit! Need confirmation how to do?
-
Hello there, i’ve compiled my HTML5 game, everything’s ok.
Engine: Rpg Maker MV.
I just need a confirmation when user press quit button, because now is istantanely.
I add Cordova Notification plugin (cordova dialog plugin)
Then in my project i’ve create a JS file like this:document.addEventListener("backbutton", function (e) { e.preventDefault(); navigator.notification.confirm("Are you sure want to exit from App?", onConfirmExit, "Confirmation", "Yes,No"); }, false); function onConfirmExit(button) { if (button == 2) { //If User select a No, then return back; return; } else { navigator.app.exitApp(); // If user select a Yes, quit from the app. } }
But it doesn’t work.
I’ve also try to put in
<script> JS CODE </script>
On my Index.html
And nothing…
Where i’m wrong?
Thanks
-
@lakaroth said in Instant app exit! Need confirmation how to do?:
document.addEventListener(“backbutton”, function (e) {
e.preventDefault();
navigator.notification.confirm(“Are you sure want to exit from App?”, onConfirmExit, “Confirmation”, “Yes,No”);
}, false);Try:
$(document).on(“click”, “#backbutton”, function (e) {
navigator.notification.confirm(“Are you sure want to exit from App?”, onConfirmExit, “Confirmation”, “Yes,No”);
}, false);