diff --git a/doc/Common_detail_api.md b/doc/Common_detail_api.md index 23346d3..dc0ff07 100644 --- a/doc/Common_detail_api.md +++ b/doc/Common_detail_api.md @@ -226,7 +226,7 @@ JPush SDK 会以广播的形式发送 RegistrationID 到应用程序。 var alertContent; if(device.platform == "Android") { - alertContent = window.plugins.jPushPlugin.openNotification.alert; + alertContent = event.alert; } else { alertContent = event.aps.alert; } @@ -280,7 +280,7 @@ ps:点击通知后传递的 json object 保存在 window.plugins.jPushPlugin.o var alertContent; if(device.platform == "Android") { - alertContent = window.plugins.jPushPlugin.receiveNotification.alert; + alertContent = event.alert; } else { alertContent = event.aps.alert; } @@ -339,7 +339,7 @@ ps:点击通知后传递的 json object 保存在 window.plugins.jPushPlugin.r try{ var message if(device.platform == "Android") { - message = window.plugins.jPushPlugin.receiveMessage.message; + message = event.message; } else { message = event.content; } diff --git a/example/index.html b/example/index.html index e17a8e0..eb8b11b 100644 --- a/example/index.html +++ b/example/index.html @@ -47,7 +47,7 @@ try { var alertContent; if (device.platform == "Android") { - alertContent = window.plugins.jPushPlugin.openNotification.alert; + alertContent = event.alert; } else { alertContent = event.aps.alert; } @@ -61,7 +61,7 @@ try { var alertContent; if (device.platform == "Android") { - alertContent = window.plugins.jPushPlugin.receiveNotification.alert; + alertContent = event.alert; } else { alertContent = event.aps.alert; } @@ -75,7 +75,7 @@ try { var message; if (device.platform == "Android") { - message = window.plugins.jPushPlugin.receiveMessage.message; + message = event.message; } else { message = event.content; } diff --git a/www/JPushPlugin.js b/www/JPushPlugin.js index 7cb26ed..c26610b 100644 --- a/www/JPushPlugin.js +++ b/www/JPushPlugin.js @@ -245,11 +245,10 @@ JPushPlugin.prototype.setCustomPushNotificationBuilder = function () { JPushPlugin.prototype.receiveMessageInAndroidCallback = function (data) { try { - console.log('JPushPlugin:receiveMessageInAndroidCallback') data = JSON.stringify(data) - var bToObj = JSON.parse(data) - this.receiveMessage = bToObj - cordova.fireDocumentEvent('jpush.receiveMessage', null) + console.log('JPushPlugin:receiveMessageInAndroidCallback: ' + data) + this.receiveMessage = JSON.parse(data) + cordova.fireDocumentEvent('jpush.receiveMessage', this.receiveMessage) } catch(exception) { console.log('JPushPlugin:pushCallback ' + exception) } @@ -257,11 +256,10 @@ JPushPlugin.prototype.receiveMessageInAndroidCallback = function (data) { JPushPlugin.prototype.openNotificationInAndroidCallback = function (data) { try { - console.log('JPushPlugin:openNotificationInAndroidCallback') data = JSON.stringify(data) - var bToObj = JSON.parse(data) - this.openNotification = bToObj - cordova.fireDocumentEvent('jpush.openNotification', null) + console.log('JPushPlugin:openNotificationInAndroidCallback: ' + data) + this.openNotification = JSON.parse(data) + cordova.fireDocumentEvent('jpush.openNotification', this.openNotification) } catch(exception) { console.log(exception) } @@ -269,11 +267,10 @@ JPushPlugin.prototype.openNotificationInAndroidCallback = function (data) { JPushPlugin.prototype.receiveNotificationInAndroidCallback = function (data) { try { - console.log('JPushPlugin:receiveNotificationInAndroidCallback') data = JSON.stringify(data) - var bToObj = JSON.parse(data) - this.receiveNotification = bToObj - cordova.fireDocumentEvent('jpush.receiveNotification', null) + console.log('JPushPlugin:receiveNotificationInAndroidCallback: ' + data) + this.receiveNotification = JSON.parse(data) + cordova.fireDocumentEvent('jpush.receiveNotification', this.receiveNotification) } catch(exception) { console.log(exception) }