I received the notification from the sender, when I click the notification, app opened.
However, the notification return value does not call to the onMessage() function.
From the documentation , function getInitialNotification() is do what I need. But still not get any value from onMessage() when app opened.
componentDidMount(){
firebase.messaging().getInitialNotification();
firebase.messaging().onMessage(function(payload) {
console.log("Message received. ", payload);
// ...
});
}
As per documentation, getInitialNotification returns Promise, so you should use it like this:
firebase.messaging().getInitialNotification().then( initialMessage => {
console.log("Initial Message: ", initialMessage);
})
https://rnfirebase.io/docs/v3.1.x/messaging/reference/messaging#getInitialNotification
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With