I have a react native app and installed react native app & messaging, and can receive notifications, but what i need is incoming call notification, so i implemented handler to first catch the notification when app is closed, but even my log not appear in console and device just shows nodification and get fired when app is in forground, why is that?
.
.
.
messaging().setBackgroundMessageHandler(async remoteMessage => {
console.log('Message handled in the background!', remoteMessage);
});
AppRegistry.registerComponent(appName, () => App);
2
Answers
my issue was that i test it with fcm tester, notification must be data only type to not be shown
If want to see foreground notification messages then you have to use onMessage listener
Foreground state messages
Background & Quit state messages
Important note: To setup a background handler, call the setBackgroundMessageHandler outside of your application logic as early as possible