jpush jpush.openNotification和receiveNotification不执行

jpush
第三方插件
标签: #<Tag:0x00007fb83ff701d0> #<Tag:0x00007fb83fe73cf0>

(Cody) #1

用的是jcore1.1.12和jpush v3.3.2,通过别名注册,在极光后台能正常推送,但是通过2个监听方法没法获取到推送内容

  //点击推送通知 启动或唤醒应用程序时会触发该事件
  document.addEventListener("jpush.openNotification", function (event) {
//
var alertContent = event.aps.alert;
alert("点击推送通知:" + angular.toJson(event));

//doWithPush(event);

  }, false);


  document.addEventListener("jpush.receiveNotification", function (event) {

var alertContent= event.aps.alert;
alert("前台 :" + angular.toJson(event));

  }, false)

#2

你具体用的哪一个插件,cordova还是 react ,iOS还是Android,前台还是后台。

你推送的是通知还是自定义消息,将消息的详情截图看一下。


(Cody) #3

用的v1.2.0 以下版本的 cordova-plugin-jcore,旧版本插件v3.3.2jpush-phonegap-plugin

Android的通知,能正常推送 不管前台后台 这2个监听都接收不到通过alert 弹出的event


(Cody) #4


(Cody) #5
03-26 12:53:28.626 14467-14467/com.sunvou.ArthritisHousekeeper D/JIGUANG-JCore: [PushReceiver] onReceive - cn.jpush.android.intent.NOTIFICATION_OPENED_PROXY.b679de2b-fc8e-4715-ad30-eab0cf64396b
03-26 12:53:28.626 14467-14467/com.sunvou.ArthritisHousekeeper D/JIGUANG-JPush: [PushReceiverCore] onReceive - cn.jpush.android.intent.NOTIFICATION_OPENED_PROXY.b679de2b-fc8e-4715-ad30-eab0cf64396b
03-26 12:53:28.642 14467-14467/com.sunvou.ArthritisHousekeeper D/CordovaWebViewImpl: >>> loadUrl(javascript:window.plugins.jPushPlugin.openNotificationInAndroidCallback({"alert":"ceshi","title":"yanIonic","extras":{"sdktype":"JPUSH","app":"com.sunvou.ArthritisHousekeeper","cn.jpush.android.NOTIFICATION_ID":185729540,"cn.jpush.android.MSG_ID":"2553410546","cn.jpush.android.ALERT":"ceshi","cn.jpush.android.EXTRA":{},"cn.jpush.android.ALERT_TYPE":"7","cn.jpush.android.NOTIFICATION_TYPE":"0"}});)
03-26 12:53:28.646 14467-14467/com.sunvou.ArthritisHousekeeper I/Timeline: Timeline: Activity_launch_request time:12674033
03-26 12:53:28.656 14467-14467/com.sunvou.ArthritisHousekeeper D/SystemWebChromeClient: file:///android_asset/www/js/frame/home/homeController.js: Line 187 : Uncaught TypeError: Cannot read property 'alert' of undefined
03-26 12:53:28.657 14467-14467/com.sunvou.ArthritisHousekeeper I/chromium: [INFO:CONSOLE(187)] "Uncaught TypeError: Cannot read property 'alert' of undefined", source: file:///android_asset/www/js/frame/home/homeController.js (187)
03-26 12:53:28.657 14467-14467/com.sunvou.ArthritisHousekeeper D/CordovaActivity: Paused the activity.
03-26 12:53:28.659 14467-14467/com.sunvou.ArthritisHousekeeper D/CordovaActivity: Resumed the activity.
03-26 12:53:28.735 14467-14651/com.sunvou.ArthritisHousekeeper D/JIGUANG-JCore: [HttpHelper] status code:200

(Hevin) #6

“Uncaught TypeError: Cannot read property ‘alert’ of undefined”

这不是插件的问题。代码已经走到回调方法里了,只是没有弹出 alert。你参考下文档:


(Cody) #7

安卓在完全退出的情况下是接收不到推送的嘛


#8

连接断开就收不到了。