Android react native firebase无法处理通知单击\u操作导航到通知屏幕
我使用这个react-native firebase和react导航进行导航,我可以成功地从服务器或控制台推送通知,无论是在前台还是后台,但我发誓文档不太清楚如何打开通知并导航到它所属的通知屏幕。这些是我的onMessage代码Android react native firebase无法处理通知单击\u操作导航到通知屏幕,android,react-native,react-navigation,react-native-firebase,react-native-fcm,Android,React Native,React Navigation,React Native Firebase,React Native Fcm,我使用这个react-native firebase和react导航进行导航,我可以成功地从服务器或控制台推送通知,无论是在前台还是后台,但我发誓文档不太清楚如何打开通知并导航到它所属的通知屏幕。这些是我的onMessage代码 firebase.messaging().onMessage((payload) => { if(!payload.opened_from_tray){ firebase.messaging().createLocalNotificati
firebase.messaging().onMessage((payload) => {
if(!payload.opened_from_tray){
firebase.messaging().createLocalNotification({
title: payload.title,
body: payload.body,
show_in_foreground: true,
icon: "ic_launcher",
local_notification: "true",
priority: "high",
click_action:"ACTION",
opened_from_tray: true,
})
}
});
我正在运行react native firebase的3.2.2版,现在我没有使用createLocalNotification(),因此当我的应用程序关闭时,我可以使用getInitialNotification()接收通知,:)
我希望它也能解决你的问题你已经看过了吗?@Bright Lee thx快速回复让我看看it@BrightLee if understand well深度链接用于将你的应用程序与来自网站或外部应用程序的传入url链接,在那篇文章中,他们没有提到通知,我认为你可以在这些应用程序中处理点击操作库,如React-native firebase或React-native fcm,但它们的文档sucks@dannykush你找到办法了吗?你好,你能检查一下这个问题吗@frontendkiller
firebase.messaging().getInitialNotification()
.then(payload => {
console.log(payload);
if(payload.slug != undefined){
this.props.navigation.navigate('notification',{slug:payload.slug});
}else{
}
});