jpush-react-native 如何监听通知被打开
intent应该如何写才能在react native 的notificationListener
回调中收到notificationOpened
的事件呢?目前只能收到 notificationArrived 事件
import JPush from 'jpush-react-native';
JPush.initCrashHandler();
JPush.init({ appKey: 'xxx', channel: 'default-xxx', production: 1 });
//连接状态
const connectListener = result => {
console.log('connectListener:' + JSON.stringify(result));
JPush.setLoggerEnable(true);
JPush.getRegistrationID(result => console.log('registerID:' + JSON.stringify(result)));
JPush.requestPermission();
JPush.isNotificationEnabled(res => {
if (res === 0) {
PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS);
}
});
};
JPush.addConnectEventListener(connectListener);
//通知回调
const notificationListener = result => {
console.log('notificationListener:' + JSON.stringify(result));
if (result.notificationEventType === 'notificationOpened') {
// 此处没有办法收到
}
};
JPush.addNotificationListener(notificationListener);`
2023-08-10 00:09:52.309 15790-15965 RN-JPush com.myapp D onNotifyMessageArrived:NotificationMessage{notificationId=513344358, msgId='18100912284412802', appkey='xxxx', notificationContent='尊敬的zzz用户,你有一笔新资金到账,金额为1亿', notificationAlertType=7, notificationTitle='zzz到账通知321', notificationSmallIcon='', notificationLargeIcon='', notificationExtras='{}', notificationStyle=0, notificationBuilderId=0, notificationBigText='', notificationBigPicPath='', notificationInbox='', notificationPriority=0, notificationCategory='', developerArg0='', platform=0, notificationChannelId='', displayForeground='', notificationType=0', inAppMsgType=1', inAppMsgShowType=2', inAppMsgShowPos=0', inAppMsgTitle=, inAppMsgContentBody=, inAppType=0, inAppShowTarget=null, inAppClickAction=null, inAppExtras=}
2023-08-10 00:09:52.311 15790-17175 ReactNativeJS com.myapp I notificationListener:{"content":"尊敬的zzz用户,你有一笔新资金到账,金额为1亿","messageID":"18100912284412802","title":"zzz到账通知321","notificationEventType":"notificationArrived"}
2023-08-10 00:09:55.389 15790-18002 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:09:57.411 15790-18006 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:09:59.428 15790-18013 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:10:01.449 15790-18017 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:10:11.550 15790-18034 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:10:13.570 15790-18038 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:10:15.598 15790-18042 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:10:17.614 15790-18046 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:10:27.707 15790-18062 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:10:29.726 15790-18066 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:10:31.739 15790-18070 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:10:33.768 15790-18074 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:10:43.869 15790-18090 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:10:45.885 15790-18094 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:10:47.898 15790-18098 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:10:49.925 15790-18102 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:00.026 15790-18118 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:02.053 15790-18122 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:04.078 15790-18126 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:06.106 15790-18134 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:16.166 15790-18150 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:18.187 15790-18154 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:20.207 15790-18158 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:22.231 15790-18162 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:32.329 15790-18176 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:34.373 15790-18180 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:36.407 15790-18184 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:38.441 15790-18188 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:48.557 15790-18204 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:50.571 15790-18208 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:52.593 15790-18212 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:11:54.628 15790-18216 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:04.743 15790-18232 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:06.766 15790-18236 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:08.810 15790-18240 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:10.847 15790-18244 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:20.954 15790-18260 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:22.977 15790-18264 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:24.990 15790-18268 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:27.013 15790-18272 TrafficStats com.myapp D tagSocket(124) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:28.390 15790-17187 TrafficStats com.myapp D tagSocket(124) with statsTag=0xd83ddc19, statsUid=-1
2023-08-10 00:12:37.122 15790-18294 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:39.155 15790-18298 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:41.184 15790-18302 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:43.224 15790-18306 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:53.331 15790-18322 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:55.351 15790-18326 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:57.383 15790-18330 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:12:59.408 15790-18334 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:09.543 15790-18350 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:11.578 15790-18354 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:13.628 15790-18358 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:15.639 15790-18362 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:25.743 15790-18378 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:27.770 15790-18382 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:29.783 15790-18386 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:31.799 15790-18390 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:41.883 15790-18404 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:43.900 15790-18408 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:45.924 15790-18412 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:47.964 15790-18416 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:58.028 15790-18432 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:59.552 15790-15966 JIGUANG-JPush com.myapp D [ActionHelper] doAction:jcore_on_event
2023-08-10 00:13:59.552 15790-15966 JIGUANG-JOperate com.myapp D [JOperateEventDispatch] onEvent:period_task,bundle:null
2023-08-10 00:13:59.552 15790-15966 JIGUANG-JOperate com.myapp D [JOperateHelper] periodTask
2023-08-10 00:13:59.555 15790-15967 JIGUANG-JCore com.myapp D [JCoreTCPManager] Send heart beat
2023-08-10 00:13:59.608 15790-15968 JIGUANG-JCore com.myapp D [NetworkingClient] Received bytes - len:36, pkg:com.myapp
2023-08-10 00:13:59.608 15790-15968 JIGUANG-JCore com.myapp D [NetworkingClient] [key-step]Network listening...
2023-08-10 00:13:59.614 15790-18441 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:13:59.618 15790-15967 JIGUANG-JCore com.myapp D [JCoreTCPManager] Action - onHeartbeatSucceed
2023-08-10 00:13:59.618 15790-15967 JIGUANG-JPush com.myapp D [ActionHelper] doAction:jcore_on_event
2023-08-10 00:14:00.039 15790-18442 TrafficStats com.myapp D tagSocket(159) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:02.069 15790-18448 TrafficStats com.myapp D tagSocket(159) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:04.080 15790-18452 TrafficStats com.myapp D tagSocket(159) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:14.182 15790-18468 TrafficStats com.myapp D tagSocket(159) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:16.188 15790-18472 TrafficStats com.myapp D tagSocket(159) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:18.218 15790-18476 TrafficStats com.myapp D tagSocket(159) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:20.232 15790-18481 TrafficStats com.myapp D tagSocket(159) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:30.320 15790-18497 TrafficStats com.myapp D tagSocket(159) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:32.346 15790-18501 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:34.389 15790-18505 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:36.417 15790-18509 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:46.533 15790-18525 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:48.545 15790-18529 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:50.565 15790-18533 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:14:52.588 15790-18537 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:15:02.683 15790-18553 TrafficStats com.myapp D tagSocket(134) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:15:03.824 15790-15790 JIGUANG-JOperate com.myapp D [JOperateEventDispatch] onEvent:activity_lifecycle,bundle:Bundle[{lifecycle_name=onActivityPaused, activity_hash=98913393, activity_name=com.myapp.MainActivity, activity_intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.myapp/.MainActivity bnds=[835,1177][1032,1485] }}]
2023-08-10 00:15:03.824 15790-15790 RN-JPush com.myapp D onActivityPaused
2023-08-10 00:15:03.835 15790-15790 JIGUANG-JOperate com.myapp D [JOperateEventDispatch] onEvent:activity_lifecycle,bundle:Bundle[{lifecycle_name=onActivityCreated, activity_hash=74299486, activity_name=cn.jpush.android.service.JNotifyActivity, activity_intent=Intent { act=cn.jpush.android.intent.NOTIFICATION_OPENED flg=0x10800000 cmp=com.myapp/cn.jpush.android.service.JNotifyActivity (has extras) }}]
2023-08-10 00:15:03.836 15790-15790 RN-JPush com.myapp D onActivityCreated
2023-08-10 00:15:03.839 15790-15790 JIGUANG-JOperate com.myapp D [JOperateEventDispatch] onEvent:report_reserved,bundle:Bundle[{event_property={"jg_msg_id":"18100912284412802","jg_msg_title":"zzz到账通知321","jg_msg_content":"尊敬的zzz用户,你有一笔新资金到账,金额为1亿","jg_msg_type":0,"jg_msg_url":"intent:#Intent;action=cn.jpush.android.ui.PushActivity;end","jg_task_id":"","jg_plan_id":""}, event_id=jg_message_click}]
2023-08-10 00:15:03.864 15790-15790 JIGUANG-JOperate com.myapp D [JOperateEventDispatch] onEvent:activity_lifecycle,bundle:Bundle[{lifecycle_name=onActivityCreated, activity_hash=185912111, activity_name=cn.jpush.android.ui.PushActivity, activity_intent=Intent { act=cn.jpush.android.ui.PushActivity flg=0x10400000 pkg=com.myapp cmp=com.myapp/cn.jpush.android.ui.PushActivity (has extras) }}]
2023-08-10 00:15:03.865 15790-15790 RN-JPush com.myapp D onActivityCreated
2023-08-10 00:15:03.865 15790-15790 JIGUANG-JPush com.myapp D [PushActivityImpl] parse entity form plugin plateform
2023-08-10 00:15:03.866 15790-18569 TrafficStats com.myapp D tagSocket(127) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:15:03.908 15790-15790 JIGUANG-JOperate com.myapp D [JOperateEventDispatch] onEvent:report_reserved,bundle:Bundle[{event_property={"jg_msg_id":"18100912284412802","jg_msg_title":"zzz到账通知321","jg_msg_content":"尊敬的zzz用户,你有一笔新资金到账,金额为1亿","jg_msg_type":-1,"jg_task_id":"","jg_plan_id":""}, event_id=jg_message_click}]
2023-08-10 00:15:03.912 15790-15790 JIGUANG-JOperate com.myapp D [JOperateEventDispatch] onEvent:activity_lifecycle,bundle:Bundle[{lifecycle_name=onActivityResumed, activity_hash=98913393, activity_name=com.myapp.MainActivity, activity_intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.myapp/.MainActivity bnds=[835,1177][1032,1485] }}]
2023-08-10 00:15:03.912 15790-15790 RN-JPush com.myapp D onActivityResumed
2023-08-10 00:15:03.917 15790-18571 TrafficStats com.myapp D tagSocket(154) with statsTag=0xffffffff, statsUid=-1
2023-08-10 00:15:03.928 15790-15863 EGL_emulation com.myapp D app_time_stats: avg=41885.29ms min=0.81ms max=753898.12ms count=18
2023-08-10 00:15:03.969 15790-15790 JIGUANG-JOperate com.myapp D [JOperateEventDispatch] onEvent:activity_lifecycle,bundle:Bundle[{lifecycle_name=onActivityDestroyed, activity_hash=74299486, activity_name=cn.jpush.android.service.JNotifyActivity, activity_intent=Intent { act=cn.jpush.android.intent.NOTIFICATION_OPENED flg=0x10800000 cmp=com.myapp/cn.jpush.android.service.JNotifyActivity (has extras) }}]
2023-08-10 00:15:03.969 15790-15790 RN-JPush com.myapp D onActivityDestroyed
2023-08-10 00:15:03.970 15790-15790 JIGUANG-JOperate com.myapp D [JOperateEventDispatch] onEvent:activity_lifecycle,bundle:Bundle[{lifecycle_name=onActivityDestroyed, activity_hash=185912111, activity_name=cn.jpush.android.ui.PushActivity, activity_intent=Intent { act=cn.jpush.android.ui.PushActivity flg=0x10400000 pkg=com.myapp cmp=com.myapp/cn.jpush.android.ui.PushActivity (has extras) }}]
2023-08-10 00:15:03.970 15790-15790 RN-JPush com.myapp D onActivityDestroyed