【发布时间】:2016-08-18 12:18:03
【问题描述】:
我使用 Push Plugin ,当我发送带有操作按钮 1) 接受 2) 忽略的推送时。
当通知到来时,我被点击了“接受”按钮。但我想要带有“接受”按钮回调的参数。从此我将识别通知的“接受”被调用。
代码参考
//initialization of push object
var push = PushNotification.init({
"android": {
"alert": "true",
"senderID": CONFIG.PROJECT_NUMBER,
"icon": "img/ionic.png",
"iconColor": "blue",
"badge": "true"
},
"ios": {
"alert": "true",
"badge": "true",
"sound": "true"
},
"windows": {
}
});
//listner for getting registration detail of device
push.on('registration', function(data) {
device_id_for_push=data.registrationId;
});
//listner called on new push notification
push.on('notification', function(data) {
// app.onPushAccept(data);
alert("on notification");
alert(JSON.stringify(data));
});
//error listner
push.on('error', function(e) {
// alert(e);
// alert("push error");
});
app.onPushAccept=function(data){
alert("onPushAccept")
alert(JSON.stringify(data));
// cordova.plugins.notification.badge.clear();
// cordova.plugins.notification.badge.increase();
}
代码中的“app.onPushAccept”函数是“接受”按钮的回调..
请尽快帮助我。 谢谢你。。
【问题讨论】:
标签: android cordova push-notification