-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Issue
👋 In our project we are using RNFB v5 and we are migrating to v6 however when we receive push notification on IOS we would expect that onMessage is called. This is not happening when application is in foreground.
It seems that RNFB/messaging does not handle push notifications at all if they were not send via gcm / firebase? I see a lot of weird conditions if ("gcm.message_id")
We are sending push notifications to our devices via pinpoint which does not have gcm.message_id in payload and therefor this condition always fails...
Example of such condition:
react-native-firebase/packages/messaging/ios/RNFBMessaging/RNFBMessaging+AppDelegate.m
Line 132 in 514e6bd
| if (userInfo[@"gcm.message_id"]) { |
If I remove this condition, then callback is called in our application. This seems like a bug to me as it was kind of working in v5 but it is not working in v6.
Here is also how the "userInfo" for received notification looks like for us:
{
aps = {
alert = {
body = "Date with time: 1";
title = "Title2 with datetime";
};
"content-available" = 1;
"mutable-content" = 0;
sound = "custom.wav";
};
data = {
jsonBody = {
customerId = 1;
messageCode = "test_notification";
notificationId = "c964ebb8-85a9-42b7-9be5-00a90ea4cb6b";
};
};
}
Project Files
Javascript
Click To Expand
package.json:
"@react-native-firebase/app": "13.0.1",
"@react-native-firebase/messaging": "13.0.1",firebase.json for react-native-firebase v6:
# N/AiOS
Click To Expand
ios/Podfile:
- I'm not using Pods
- I'm using Pods and my Podfile looks like:
# N/AAppDelegate.m:
// N/AAndroid
Click To Expand
Have you converted to AndroidX?
- my application is an AndroidX application?
- I am using
android/gradle.settingsjetifier=truefor Android compatibility? - I am using the NPM package
jetifierfor react-native compatibility?
android/build.gradle:
// N/Aandroid/app/build.gradle:
// N/Aandroid/settings.gradle:
// N/AMainApplication.java:
// N/AAndroidManifest.xml:
<!-- N/A -->Environment
Click To Expand
react-native info output:
info Fetching system and libraries information...
System:
OS: macOS 12.0.1
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 243.30 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 1.22.15 - /usr/local/bin/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK:
API Levels: 23, 26, 27, 28, 29, 30, 31
Build Tools: 28.0.3, 29.0.0, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 32.0.0
System Images: android-27 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-31 | Google APIs Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7583922
Xcode: 12.4/12D4e - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_275 - /Users/dusan.plavak/.sdkman/candidates/java/current/bin/javac
Python: 2.7.18 - /usr/bin/python
npmPackages:
@react-native-community/cli: 6.1.0 => 6.1.0
react: 17.0.2 => 17.0.2
react-native: 0.65.1 => 0.65.1
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
- Platform that you're experiencing the issue on:
- iOS
- Android
- iOS but have not tested behavior on Android
- Android but have not tested behavior on iOS
- Both
react-native-firebaseversion you're using that has this issue:13.0.1
Firebasemodule(s) you're using that has the issue:messaging
- Are you using
TypeScript?Y&4.4.2
- 👉 Check out
React Native FirebaseandInvertaseon Twitter for updates on the library.