I want to implement opening a specific screen when interacting with a Push Notification sent from Firebase. My understanding is that I needed to use was getInitialNotification()
function that was available in react-native-firebase v5
and lower, but is not available yet in react-native-firebase v6
, since the Notifications package is not yet ready.
Among other things, so far I have tried setting the background message handler that is available in the Cloud Messaging package, but it doesn't seem to work for something that is not a data-only
message:
Firebase.messaging().setBackgroundMessageHandler(async (remoteMessage) => {
await storeJSONData('notification', JSON.stringify(remoteMessage));
});
Should I downgrade to react-native-firebase v5
in order to use their getInitialNotification()
from the Notifications package, or do I have other better alternatives, like even using android native code?