简体   繁体   English

Cordova / PhoneGap 4通知不适用于Android

[英]Cordova/PhoneGap 4 Notification not working on Android

I am currently working on a PhoneGap/Cordova project. 我目前正在从事PhoneGap / Cordova项目。 I am using Cordova v4. 我正在使用Cordova v4。 My problem is that the notification dialogs are not working. 我的问题是通知对话框不起作用。 I already added the plugin via CLI based on its documentation here . 我已经根据此处的文档通过CLI添加了该插件。

And on my index.js file, under the onDeviceReady function, I added this code: 在index.js文件的onDeviceReady函数下,添加了以下代码:

navigator.notification.alert(
    'You are the winner!',  // message
    alertDismissed,         // callback
    'Game Over',            // title
    'Done'                  // buttonName
);

And here's my alertDismissed function: 这是我的alertDismissed函数:

function alertDismissed(){
    console.log('alert dismissed');
}

Do you have any idea what's the problem? 你有什么问题吗? Please help! 请帮忙! Thanks! 谢谢!

I was able to make this work. 我能够完成这项工作。 I just created a new project and install all the plugins that I needed including this one and copy all my assets to the newly created project. 我刚刚创建了一个新项目,并安装了所需的所有插件(包括该插件),并将所有资产复制到新创建的项目中。 And voila! 瞧! it works! 有用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM