Home > Mobile >  How to use navigator.app.exitApp() after navigator.notification.alert
How to use navigator.app.exitApp() after navigator.notification.alert

Time:04-25

receivedEvent: function (id) {
    if (navigator.connection.type == Connection.NONE) {
        navigator.notification.alert('NO NETWORK CONNECTION', null, 'Warning', 'OK');
        }
        else {
            window.open('my_web_site', '_self');
        }
}

how close aplication after button OK

CodePudding user response:

You can use the confirm method instead of alert to show a message.

receivedEvent: function (id) {
    if (navigator.connection.type == Connection.NONE) { 
        navigator.notification.confirm("NO NETWORK CONNECTION", function(e){navigator.app.exitApp();}, ["Warning"], ["Ok"])
    }
    else {
        window.open('my_web_site', '_self');
    }
}
  • Related