gpt4 book ai didi

push-notification - 在 native react 中单击远程推送通知时重定向到特定屏幕(应用程序处于后台状态)

转载 作者:行者123 更新时间:2023-12-04 17:07:40 28 4
gpt4 key购买 nike

我想在 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com