Exit windows app confirmation button not working

150 views Asked by At

I am developing a windows app with an exit button to exit the app with a confirmation. The button is placed on the top of the app using html5, jquery-mobile, ajax, and phonegap. The problem is with me, I used the code that it's written below and is not working in windows app. Even the alert is not working.

So i used

var msg = new Windows.UI.Popups.MessageDialog("No image is selected");
        msg.showAsync();

And it is working fine. Can anyone help me to find the problem out?

 navigator.notification.confirm("Do you really want to close this app?", function (buttonIndex) {
    ConfirmExit(buttonIndex);
    },
    "Confirmation",
    "Yes,No"
);
function ConfirmExit(stat) {
alert("Inside ConfirmExit");
if (stat == "1") {
    navigator.app.exitApp();
} else {
    return;
};
};
1

There are 1 answers

0
Bellash On

The way you are calling the function, and the alert!

I haven't tried this but I think you may it a try

  navigator.notification.confirm("Do you really want to close this app?"
       , ConfirmExit,
       "Confirmation",
       ["Yes","No"]
   );

and there is navifator.notification.alert to alert a message

 function ConfirmExit(stat) {
     //alert("Inside ConfirmExit");
  navigator.notification.alert("Inside ConfirmExit", null, "Alert", null)

   if (stat == "1") {
       navigator.app.exitApp();
   }
 };