作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在 android 和 iOS 上点击推送通知后重定向到收件箱屏幕
Case 1: App already opened on android. - Successfully Working
收到推送通知。点击通知页面成功重定向到收件箱。
NOTIFICATION: {"dealer": "SWRoa0ZhSkN4Y2hQNW1NeWtFdHFvSDNlcXIyNnc1TG5PS1hOZjJoMElHST0=", "finish": [Function finish], "foreground": false, "id": "-1073464079", "message": "hello", "messagetype": "RESPONSE", "subject": "ENQUIRY RESPONSE", "title": “Sample 1”, "userInteraction": true}
PushNotification.configure({
onNotification: function(notification) {
console.log("NOTIFICATION:", notification);
console.log('NOTIFICATION CLICK STATE : --->' + notification.userInteraction);
if(notification.userInteraction === true) {
NavigationService.navigate('Inbox');
}
},
popInitialNotification: true,
});
Case 2: App running in background or closed on android - Failed
收到推送通知。单击通知页面重定向不起作用,只能打开应用程序。
没有收到通知数据
Case 3: On IOS in case of app opened or closed. - Failed
收到推送通知。单击通知页面重定向不起作用,只能打开应用程序。
没有收到通知数据
我正在使用 react-native-push-notification 库 进行推送通知。
https://github.com/zo0r/react-native-push-notification
最佳答案
也许推广其他包不好。但是,我建议查看 react-native-firebase会是个好主意。它提供了处理重定向的功能,即使应用程序不在前台也是如此。
关于push-notification - 在 native react 中单击远程推送通知时重定向到特定屏幕(应用程序处于后台状态),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60706263/
我是一名优秀的程序员,十分优秀!