jpush-react-native icon indicating copy to clipboard operation
jpush-react-native copied to clipboard

android 物理键退出App(进程还在)点击通知无法跳转到指定页面

Open smk524198002 opened this issue 8 years ago • 20 comments

  • 调试环境 小米手机 Android 6.0

  • 插件版本: "jcore-react-native": "^1.2.5", "jpush-react-native": "file:..", "react": "16.2.0", "react-native": "0.52.0", "react-navigation": "^1.0.0-beta.25"

期望效果

在Demo里面 点击物理返回键退出app,接收到推送消息,点击消息,跳转到指定页面(Demo中的SecondActivity)

实际效果

点击通知,没有跳转到指定页面,停留在首页

重现步骤

  1. 点击物理返回键退出app
  2. 推送消息
  3. 点击接收消息
  4. APP启动,没有跳转到指定页面

Debug logs

warn: Can only update a mounted or mounting component. This usually means you called setState, replaceState, or forceUpdate on an unmounted component. This is a no-op. Please check the code for the Navigation Container component.

smk524198002 avatar Feb 07 '18 07:02 smk524198002

@smk524198002 我用 demo 测试可以跳转啊。

  • 调试环境 乐视手机 Android 6.0

  • 插件版本: "jcore-react-native": "^1.2.3", "jpush-react-native": "file:..", "react": "16.2.0", "react-native": "0.52.0", "react-navigation": "^1.0.0-beta.25"

KenChoi1992 avatar Feb 07 '18 08:02 KenChoi1992

@KenChoi1992 是退出App之后,点击推送消息跳转吗?

smk524198002 avatar Feb 07 '18 09:02 smk524198002

嗯

KenChoi1992 avatar Feb 07 '18 09:02 KenChoi1992

@KenChoi1992 重新下载了demo 还是有这个问题。如图 wechatimg6

smk524198002 avatar Feb 08 '18 02:02 smk524198002

遇见了相同的问题, 退出app之后点击通知栏无法跳转到指定页面,并报相同的黄色warning

NikiLee2016 avatar Feb 12 '18 09:02 NikiLee2016

我用 demo 测试可以跳转,无论进程是否被杀死还是在后台。你们设置一下允许自启动试试。

KenChoi1992 avatar Feb 23 '18 03:02 KenChoi1992

@KenChoi1992 我理解问题的原因是这样的 大家一般在 componentDidMount 注册事件,在 componentWillUnmount 解绑事件。现在 notifyJSDidLoad 解决了触发事件时 JS 还没有准备好的问题。

但是新问题是,按下 Android 手机 Back 键回到 Home 时,React Component 已经 Unmount 了,停止接收新事件了。这时候如果点击了通知,JPush 依然立即下发事件,没有缓存住等下一次 componentDidMount notifyJSDidLoad 触发。

所以这里是不是我们再加个 API 类似 notifyJSDidUnload,然后缓存所有事件等 ReactNative 准备好?

chuangbo avatar Mar 14 '18 05:03 chuangbo

@KenChoi1992 测试了 demo 在这个情况也是不能跳转到第二个 Screen 的。

具体测试方法是

  1. 打开 Demo
  2. 点击 Init Push
  3. 按手机的 Back 按钮,退出到 Home
  4. 发送通知
  5. 点击通知
  6. Log 写了 jump to second activity,但是实际并没有跳转

原因应该是我上面猜测的,在 this.props.navigation.navigate('Push') 的时候 Component 还没有 Mount.

请有空麻烦帮忙看看,多谢了。

chuangbo avatar Mar 14 '18 07:03 chuangbo

我也有同样的问题,APP kill 以后能收到通知,但点击通知没有效果,只能停留在首页。

jswxwxf avatar Apr 05 '18 14:04 jswxwxf

@chuangbo 并不是这个原因,即使在 Mount 之前注册也没有用

sapjax avatar Apr 27 '18 10:04 sapjax

您好,请问您的这个问题解决了吗

Silence-more avatar Jul 17 '18 10:07 Silence-more

看看移除监听的时候有没有这个方法JPushModule.clearAllNotifications()?

Code4GL avatar Sep 11 '18 02:09 Code4GL

现在这个问题是解决没有呢?我感觉是有时候能跳,大部分时间都跳转不了

quietautumn avatar Sep 20 '18 07:09 quietautumn

有没有好的解决办法

httol avatar Oct 11 '18 07:10 httol

@JoshLipan any updates?

Yunnathai avatar Oct 18 '18 02:10 Yunnathai

更新至v2.2.12修复此问题

JoshLipan avatar Oct 22 '18 08:10 JoshLipan

@JoshLipan 谢谢大佬

showtan001 avatar Oct 25 '18 08:10 showtan001

@JoshLipan 大佬 ios后台时候addReceiveNotificationListener没执行 ,Android可以

showtan001 avatar Oct 26 '18 03:10 showtan001

@showtan001 点击无法跳转指定页面问题关闭了,你的问题请重新提个issue

JoshLipan avatar Oct 29 '18 05:10 JoshLipan

这个问题还在。。。 v2.5.3

Natuka avatar May 03 '19 07:05 Natuka