im工作在phonegap v5.3.6和cordova v5.3.3。我在README上做了一切,但插件无法正常工作。Phonegap推送插件安装
这是我的代码如下;
onDeviceReady: function() {
var push = PushNotification.init({
"android": {
"senderID": "MY_SENDER_ID"
},
"ios": {},
"windows": {}
});
push.on('registration', function(data) {
console.log("registration event");
document.getElementById("regId").innerHTML = data.registrationId;
console.log(JSON.stringify(data));
});
push.on('notification', function(data) {
console.log("notification event");
console.log(JSON.stringify(data));
var cards = document.getElementById("cards");
var push = '<div class="row">' +
'<div class="col s12 m6">' +
' <div class="card darken-1">' +
' <div class="card-content black-text">' +
' <span class="card-title black-text">' + data.title + '</span>' +
' <p>' + data.message + '</p>' +
' </div>' +
' </div>' +
' </div>' +
'</div>';
cards.innerHTML += push;
});
push.on('error', function(e) {
console.log("push error");
});
}
它不会抛出任何成功或错误消息。此代码短语有什么错误?
这里是插件的混帐回购协议:https://github.com/phonegap/phonegap-plugin-push
谢谢您的帮助
[Push Plugin](https://github.com/phonegap-build/PushPlugin)已弃用,所以我使用[this one](https://github.com/phonegap/phonegap-plugin-push )。 另外一个没有为我工作。 –
您可能有其他问题。我已经使用https://github.com/phonegap-build/PushPlugin。请在评论中输入你的错误。 – Dhruv
我试图弄清楚会发生什么,但现在它会抛出一个错误,即“Class not foud。”。我搜索了一个修复程序,我尝试了所有的建议,但我失败了。我认为这些插件没有工作,因为config.xml文件。我会在修复config.xml文件后通知您。谢谢btw。 –