android模拟器上点击通知addReceiveOpenNotificationListener不执行
插件版本:
"jcore-react-native": "^1.2.3",
"jmessage-react-plugin": "^2.3.4",
"jpush-react-native": "^2.1.12",
模拟器版本:android 7.1.1
问题与 https://community.jiguang.cn/t/jpushsdk-rn-android/18727 类似
我的componentDidMount代码如下
componentDidMount() {
// this.timeout = setTimeout(()=>{
// this.setState({
// toPage: this.props.homeTabIndex,
// })
// },500)
if (Platform.OS === 'android') {
JPushModule.initPush()
JPushModule.notifyJSDidLoad(resultCode => {
if (resultCode === 0) {
}
})
if (Platform.OS === 'ios') {
JPushModule.setupPush()
}
}
JPushModule.addReceiveCustomMsgListener(map => {
this.setState({
pushMsg: map.message
})
console.warn('extras: ' + map.extras)
})
JPushModule.addReceiveNotificationListener(map => {
console.warn('alertContent: ' + map.alertContent)
console.warn('extras: ' + map.extras)
// var extra = JSON.parse(map.extras);
// console.log(extra.key + ": " + extra.value);
})
JPushModule.addReceiveOpenNotificationListener(map => {
console.warn('Opening notification!')
console.warn('map.extra: ' + map.extras)
this.jumpSecondActivity()
// JPushModule.jumpToPushActivity("SecondActivity");
})
JPushModule.addGetRegistrationIdListener(registrationId => {
console.warn('Device register succeed, registrationId ' + registrationId)
})
}
logcat日志
03-30 02:30:02.124 2244 5638 I DeviceStateChecker: DeviceStateChecker cancelled
03-30 02:30:02.124 2244 2244 I MicroDetectionWorker: #onError(false)
03-30 02:30:02.127 2244 2258 I art : Background partial concurrent mark sweep GC freed 8501(486KB) AllocSpace objects, 11(3MB) LOS objects, 29% free, 9MB/13MB, paused 12.493ms total 50.050ms
03-30 02:30:03.572 1400 1429 W audio_hw_generic: Not supplying enough data to HAL, expected position 2988210 , only wrote 2988000
03-30 02:30:03.583 1703 2389 W InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@382fccf attribute=null, token = android.os.BinderProxy@75345ee
03-30 02:30:03.602 1703 1932 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x34000000 pkg=com.localsapp cmp=com.localsapp/.MainActivity} from uid 10098 on display 0
03-30 02:30:03.620 4803 5644 W unknown:ReactNative: Calling JS function after bridge has been destroyed: RCTDeviceEventEmitter.emit(["JMessage.ClickMessageNotification",{"message":{"text":"50","type":"text","unreceiptCount":0,"createTime":1522376975040,"extras":{"houseSourceId":"931070310679842821","endDate":"2018-04-16","houseSourceTitle":"【广州风情 怀旧情怀】老广州的情怀公园前地铁 北京路步行街","fromUserName":"929958907529794216","groupId":"10522524","messageTypeId":"0","conversationId":"978175592566624256","sendUserAvatar":"/UploadFiles/UserPic/111241/111241_170702134722_3e3e714d845b4da6b04c8e732b004e07.jpeg","messageSource":"LocalsApp","bookingId":"978175589230063616","conversationType":"group","startDate":"2018-04-15"},"target":{"isNoDisturb":false,"maxMemberCount":500,"owner":"930684000658272256","isBlocked":false,"desc":"13632412408预订【广州风情 怀旧情怀】老广州的情怀公园前地铁 北京路步...入住时间:18/04/15退房时间:2018/04/16","name":"13632412408预订931070310679842821","id":"10522524","ownerAppKey":"f9b3d6bbebb59c4c8c6f8fb5","level":0,"type":"group"},"from":{"isFriend":false,"isInBlackList":false,"isNoDisturb":false,"noteName":"","type":"user","username":"929958907529794216","noteText":"","region":"","appKey":"f9b3d6bbebb59c4c8c6f8fb5","nickname":"Carol_茵","gender":"unknown","address":"","avatarThumbPath":"","birthday":0,"signature":""},"serverMessageId":"785024623","id":"2"}}])
03-30 02:30:03.658 1703 2389 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x34000000 pkg=com.localsapp cmp=com.localsapp/.MainActivity} from uid 10098 on display 0
03-30 02:30:03.739 2244 2244 W SearchService: Abort, client detached.
03-30 02:30:03.743 1400 1429 W audio_hw_generic: Hardware backing HAL too slow, could only write 0 of 720 frames
03-30 02:30:03.834 4803 4803 W unknown:ReactNative: Packager connection already open, nooping.
03-30 02:30:03.856 4803 4835 D EGL_emulation: eglMakeCurrent: 0xa171c780: ver 3 0 (tinfo 0xa1771650)
03-30 02:30:03.889 1400 1429 W audio_hw_generic: Hardware backing HAL too slow, could only write 0 of 720 frames
03-30 02:30:03.903 1400 1429 W audio_hw_generic: Hardware backing HAL too slow, could only write 0 of 720 frames
03-30 02:30:04.004 4803 5200 I ReactNativeJS: 'VirtualizedList: You have a large list that is slow to update - make sure your renderItem function renders components that follow React performance best practices like PureComponent, shouldComponentUpdate, etc.', { dt: 52264, prevDt: 3577, contentLength: 2228.1904296875 }
03-30 02:30:04.057 1703 2067 I ActivityManager: Setting hasTopUi=false for pid=1796
03-30 02:30:04.064 1796 1796 D PhoneStatusBar: disable: < expand icons* alerts system_info* back home recent clock search quick_settings >
03-30 02:30:04.169 1796 2039 D EGL_emulation: eglMakeCurrent: 0xa14a26e0: ver 3 0 (tinfo 0xa149b4e0)
03-30 02:30:04.181 1796 2039 D EGL_emulation: eglMakeCurrent: 0xa14a26e0: ver 3 0 (tinfo 0xa149b4e0)
03-30 02:30:06.783 1400 1430 W audio_hw_generic: Not supplying enough data to HAL, expected position 3294442 , only wrote 3142080