因此,我已经将我的项目的Firebase从v@5迁移到v@14,因为推通知在android API31+(v12)上根本不起作用。
注意:我们使用react-native-splash-screen__。福克指出了https://github.com/invertase/react-native-firebase/issues/4005、https://github.com/invertase/react-native-firebase/issues/2768和https://github.com/crazycodeboy/react-native-splash-screen/issues/289存在的一些问题,并建议从旧的飞溅法转向react-native-bootsplash作为一种选择,这对我们来说并不是真正的解决办法。PS。以上链接中的任何评论都没有帮助。
firebase.messaging().onNotificationOpenedApp -与初始推送不同,在后台模式下,push服务表现良好。
发布于 2022-01-28 12:32:43
我的问题通过使用来自3d party库的API (如react-native-push-notification firebase.messaging().getInitialNotification()**.** )而不是firebase.messaging().getInitialNotification()**.**来解决。
const getAndroidInitialNotification = (remoteMessage: ReceivedNotification | null): void => {
const data = remoteMessage?.data;
if (data) {
// Your code such deep links implementation, dispatch to reducer etc...
}
};
PushService.popInitialNotification(handleInitialNotifications);希望这将有助于像我这样的人,谁不明白什么是飞溅方法对消防服务和所有相关的混乱的东西的影响。
https://stackoverflow.com/questions/70893858
复制相似问题