In the Android platform, messaging().onMessage() is working as expected, but onNotificationOpenedApp and getInitialNotification are not functioning as anticipated. I aim to manage navigation to the chat room screen when the user opens the app by clicking on the notification.
const onNotificationOpenedAppFromBackground = async () => {
const unsubscribe = messaging().onNotificationOpenedApp(
async remoteMessage => {
console.log(
'App opened from BACKGROUND by tapping notification:',
JSON.stringify(remoteMessage),
);
},
);
return unsubscribe;
};
const onNotificationOpenedAppFromQuit = async () => {
const message = await messaging().getInitialNotification();
if (message) {
console.log(
'App opened from QUIT by tapping notification:',
JSON.stringify(message),
);
}
};