Anyone knows how to display iOS notification in foreground(when app is open). I'm using react-native-fcm. Everything works fine the android notification also shows in foreground but not in iOS.
I've followed everything in the documentation. The following didReceiveRemoteNotification method also gets called. On FCM.On() listener notification data is also visible. But only notification do not shows in banner while iOS app is open.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
[RNFIRMessaging didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
The payload used is following:
to = deviceId,
badge = 0,
notification = new
{
title = "test",
body = "body",
sound = "default",
priority = "high",
badge = 0,
show_in_foreground = true,
},
data = new
{
badge = 0,
title = "title",
body = "body",
sound = "default",
fcmMessageType = notifType,
show_in_foreground = true,
},
content_available = true,
priority = "high",
};