i使用" https://github.com/phonegap/phonegap-plugin-push"插件,以在我的离子应用中实现推送通知。
当"通知"事件称为"/android_asset/www/cordova.js"文件中时。
[INFO:CONSOLE(312)] "Error in Success callbackId: PushNotification1569630827
: TypeError: Cannot read property 'info' of undefined", source:
file:///android_asset/www/cordova.js (312)
这是从"通知"事件推出的数据
{
"sound": "notification",
"title": "Message from customer",
"message": "testtesttesttesttesttest",
"additionalData": {
"info": {
"merchantCode": 74071,
"name": "sudesh",
"chatSessionId": "lrzbeBImhK_Qws7qcEbjDAnBzrbXr5AVJFVrQlkZ",
"time": "Tue Mar 14 11:04:41 UTC 2017",
"title": "Message from customer",
"body": "testtesttesttesttesttest",
"type": "customer"
},
"dismissed": false,
"google.message_id": "0:1489489453397457%c71401d800000031",
"coldstart": false,
"collapse_key": "1",
"foreground": false
}
}
尝试此改变: push.on('notification', this.onNotification)
到 : push.on('notification', app.onNotification)