Hi,
Using below code to show notification in iOS when app running in foreground.Background notification working properly. In console I can see the payload prints when app running in foreground but no notification/ banner shown.
this.firebase.messaging().createLocalNotification({
title: 'Test App',
body: msg,
icon: 'ic_launcher',
id: new Date().getTime()+"",
click_action: "ACTION",
action: "Action",
screen: "Chat",
content_available:true,
show_in_foreground:true,
priority:"high",
sound: 'default',
opened_from_tray: false });
:ios, '9.0'
target 'TestApp' do
pod 'Firebase/Core'
pod 'RNFirebase', :path => '../node_modules/react-native-firebase'
pod 'Firebase/AdMob'
pod 'Firebase/Analytics'
pod 'Firebase/Auth'
pod 'Firebase/Crash'
pod 'Firebase/Database'
pod 'Firebase/DynamicLinks'
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
pod 'Firebase/Storage'
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'BatchedBridge','Core']
pod 'GoogleMaps'
end
-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[RNFirebaseMessaging didReceiveLocalNotification:notification];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo {
[RNFirebaseMessaging didReceiveRemoteNotification:userInfo];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo
fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
[RNFirebaseMessaging didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
willPresentNotification:(UNNotification *)notification
withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
[RNFirebaseMessaging willPresentNotification:notification withCompletionHandler:completionHandler];
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)())completionHandler {
[RNFirebaseMessaging didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
}
Please fill out the issue template correctly.
Updated
Thanks for reporting. We're aware of lots of issues with notifications and will be addressing them all as part of the v3.2.0 release stream. Please see https://github.com/invertase/react-native-firebase/issues/595 for updates.
im also facing this issue ..any heads up of how to go about ? only in ios foreground notification doesnt show up...android is good
Good news, the long awaited alpha of our messaging and notifications overhaul is now available!!
Check out the release notes here: https://github.com/invertase/react-native-firebase/releases/tag/v4.0.0-alpha.1
If you have any comments and suggestions or want to report an issue, come find us on Discord
I am also getting this issue and there seems no way to correct it if you are dealing with two notifications SDKs.
I am not using the default swizzling that most apps use with firebase because I have another notifications SDK integrated for customer support (similar to intercom). I'm using react-native-firebase 5.2.2, and it expects willPresentNotification
to be called, through swizzling I presume. If the willPresentNotification
could just be exposed in the RNFirebaseNotifications.h
header, then it would allow users to fix this issue if they're not using swizzling by hitting it directly. @chrisbianca - does this seem possible?
Nevermind, I was able to fix it with the following, routing willPresent
back without swizzling
public func userNotificationCenter(_ center: UNUserNotificationCenter,
willPresent notification: UNNotification,
withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
) {
//...
(RNFirebaseNotifications.instance() as! UNUserNotificationCenterDelegate).userNotificationCenter!(center, willPresent: notification, withCompletionHandler: completionHandler)
Hi @wildseansy , do you know how to solve this in objective-C
Most helpful comment
im also facing this issue ..any heads up of how to go about ? only in ios foreground notification doesnt show up...android is good