Javascript 导航器通知警报在Cordova中不工作

Javascript 导航器通知警报在Cordova中不工作,javascript,android,cordova,phonegap-plugins,cordova-plugins,Javascript,Android,Cordova,Phonegap Plugins,Cordova Plugins,我正试图用Cordova打印一个警报,只有当我用Ripple Chrome扩展模拟我的应用程序时,它才会起作用 在我的三星Galaxy S3中,单击按钮时不会发生任何事情 我用的是Cordova 3.6.3-0.2.13。 我已将以下插件添加到我的项目中: org.apache.cordova.dialogs和 org.apache.cordova.vibration。 (如果我键入“cordova插件ls”,它们都会出现) 你能帮我吗?提前感谢道森的评论应该有用 正如您在Cordova文档页面

我正试图用Cordova打印一个警报,只有当我用Ripple Chrome扩展模拟我的应用程序时,它才会起作用

在我的三星Galaxy S3中,单击按钮时不会发生任何事情

我用的是Cordova 3.6.3-0.2.13。 我已将以下插件添加到我的项目中: org.apache.cordova.dialogs和 org.apache.cordova.vibration。 (如果我键入“cordova插件ls”,它们都会出现)


你能帮我吗?提前感谢

道森的评论应该有用

正如您在Cordova文档页面上看到的:

守则:

navigator.notification.alert
在加载cordova库之后。请尝试将
getInfo()
函数移动到
index.js的底部
var app = {
    // Application Constructor
    initialize: function() {
        this.bindEvents();
    },
    // Bind Event Listeners
    //
    // Bind any events that are required on startup. Common events are:
    // 'load', 'deviceready', 'offline', and 'online'.
    bindEvents: function() {
        document.addEventListener('deviceready', this.onDeviceReady, false);
    },
    // deviceready Event Handler
    //
    // The scope of 'this' is the event. In order to call the 'receivedEvent'
    // function, we must explicitly call 'app.receivedEvent(...);'
    onDeviceReady: function() {
        app.receivedEvent('deviceready');
    },
    // Update DOM on a Received Event
    receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');

        console.log('Received Event: ' + id);
    }
};

app.initialize();
navigator.notification.alert