jpush react native android 持续收到同一条推送
componentDidMount中:(componentWillUnmount有中对应remove)
JPushModule.addReceiveCustomMsgListener((message) => {
console.log(message);
});
JPushModule.addReceiveNotificationListener((message) => {
console.log("receive notification: ");
console.log(message);
});
JPushModule.addReceiveOpenNotificationListener((map) => {
console.log("Opening notification!");
let data=JSON.parse(map.extras);
Actions.home_post({
postId: data.postId
})
});
通过极光控制台web发送推送,extra中填好postId,现在有意思的问题是:
1.应用前台开启,则成功收到推送,点击推送通知栏顺利跳转对应postId页面,没问题。
2.应用在后台开启状态时,能收到推送,点击推送通知栏,应用跳至前台,但页面停留至首页,跳转postId页面无效,无其他问题,极光控制台看到(目标|成功)由 1|0 正确变为 1|1。
3.应用未开启时,能收到推送,点击推送通知栏,无法启动应用,但极光控制台看到(目标|成功)由 1|0 正确变为 1|1。有趣的问题来了:这条推送会3秒左右loop不停推送,除非手动开启应用操作步骤1可清除loop
一定是我姿势不对~~求3的原因(2的问题也不明白,Actions是用的react-native-router-flux)