如何在 navigator.notification.alert 之后使用 navigator.app.exitApp()

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

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');
        }
}

按钮后如何关闭应用程序 OF

您可以使用 confirm 方法而不是 alert 来显示消息。

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');
    }
}