Right now I can handle messages when the app is open, minimized, or closed, but when I click on the notification. How to process a message if a user logs into the application without notification?
useEffect(() => {
messaging().setBackgroundMessageHandler(async remoteMessage => {
handlerMessage(remoteMessage)
setInitialRoute('Messenger')
});
messaging().onMessage(async remoteMessage => {
handlerMessage(remoteMessage);
});
messaging()
.getInitialNotification()
.then(remoteMessage => {
if (remoteMessage) {
handlerMessage(remoteMessage);
setInitialRoute('Messenger')
}
});
}, []);