我已經使用Push Plugin,當我發送推動按鈕1)接受2)忽略。科爾多瓦Android推動通知與行動按鈕
當通知來了,我被點擊了「接受」按鈕。但我想用「接受」按鈕回調參數。從那我會確定與通知的「接受」被稱爲。
碼參考
//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」 功能是 「接受」 按鈕的回調..
請儘快幫助我。 謝謝。
非常感謝你,這個解決方案真的很有用.. –