can't able to route to the particular screen when the app is killed
dcpliot opened this issue · comments
Before openning an issue
- Reproduce it with the example project in this repo.
- If you can't receive iOS notification, make sure you can receive notification using quickstart-ios project provided by Firebase team
When openning an issue, please include following information for better support
- What version of RN and react-native-fcm are you running?
- What device are you using? (e.g iOS9 emulator, Android 6 device)?
- Is your app running in foreground, background or not running?
I am able to receive the data when I my app is foreground and background and able to route to the particular screen on clicking the notification tray.But when the app is killed,I am only able to receive the notification and when I click the notification tray,can't able to route to the particular screen instead,starting from the begining.I am writing the code in the component and calling this notificationListener() from all other screens except splash screen .
` notificationListener(){
try{
this.notificationListener = FCM.on(FCMEvent.Notification, async (notif) => {
if(notif.opened_from_tray){
console.log("opened_from_tray"+JSON.stringify(notif))
console.log("Inside opened from tray")
// alert("Inside opened from tray")
this.props.navigation.navigate('EventDetails',{eventId:notif.my_key, index:2, lastScreen:'BaseScreen'})
}else{
console.log("else entairrrrr"+JSON.stringify(notif))
let notific = JSON.parse(notif.my_another_key)
// console.log(notific)
console.log("messaage"+notific.message)
console.log("eventIddd"+notific.eventId)
console.log("Senderrrridddddd"+notific.senderDetails._id)
this.setState({
eventId:notific.eventId
})
// alert(JSON.stringify(notif))
showMessage({
message:notif.fcm.title ,
description: notific.message,
type: "default",
backgroundColor: "grey", // background color
color: "white", // text color
"priority": "high"
});
// this.showLocalNotification(notif);
}
});
this.refreshTokenListener = FCM.on(FCMEvent.RefreshToken, (token) => {
console.log(JSON.stringify(notif))
// fcm token may not be available on first load, catch it here
});
}
catch(error){
alert(JSON.stringify(error.message))
}
}`
@dcpliot were you able to get this working?
@dcpliot Did you find a way to solve this?
I suggest you to use https://rnfirebase.io/. They handle this case.