-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On iOS onMessage event is not firing in Foreground #7772
Comments
Seems like the same issue as: #7770 I am also noticing this... onMessage is not firing very often (was working reliably in the past), I am occasionally getting it to fire on iOS, but can't identify anything in particular thats making it work? I did upgrade to react-native-firebase v19.2.2 yesterday (was previously on v16) but rolling back to the old version doesn't seem to help... I wonder if this is something to do with Firebase/Apple? 🤔 (btw everything is working fine on Android) |
Okay I have noticed one slightly strange thing...
So it seems like after clicking the firebase message once will result in onMessage starting to fire correct again on iOS? 🤔 |
Hi @Shervanator , Thank you for taking the time to reply, much appreciated. It seems similar to the issue you quoted #7770 but still slightly different in this case, because
It is interesting what you described above with what is happening after Force close and sending again. Unfortunately, that is not working for me. I briefly tried that with both of our apps and didn't seem to work. The only difference in what I did is me sending from AWS SNS - later I will try using the Firebase console too. I was playing around with setting I will let you know if there is any progress. Thank you, |
Okay I've narrowed my problem down, not sure if its similar to what you are seeing:
So maybe I'm running into a different issue, but that is my reproduction steps... |
Very interesting - that's good testing...
|
Thanks for the reply @mikehardy!
|
Thank you @Shervanator & @mikehardy for taking the time to check, it is really appreciated. In my case the onMessage is working correctly when sending the notification from the Firebase Console. Unfortunately, switching to sending through Firebase is not an option. Our backend have AWS SNS built in and no intention to re-structure it. Is there a way through APNS payload to force the onMessage to react? This is what we are sending: {
"aps": {
"alert": {
"title": "Tibor testing",
"body": "Test001"
}
},
"url": "https://www.azonetwork.com"
} I tried to add Any help would be appreciated. |
Unsure but I think you may need the high priority keys? A differential comparison of what your system sends vs what works when you send via the FCM REST API (so you have complete control of the JSON, critical here during testing) is how I'd go about it |
Thank you so much guys, it is now working 🎉 The Investigating further, I found useful discussions in old GitHub issues (e.g. #3479 and #5908) addressing problems with the Rather than altering the code in {
"aps": {
"alert": {
"title": "Sample Title",
"body": "Sample Message"
}
},
"url": "https://example.com",
"gcm.message_id": "123"
} I wish it was mentioned in the documentation, it would save tons of time - maybe this summary will help others going forward. |
Hello,
|
Issue
Hi All,
I am trying to fix this for months without success. If anyone can help, it would be much appreciated.
Trying to change the push notifications package used by an old app to the latest React Native and Firebase messaging. I have set up a new app from scratch to isolate the issue - all new identifiers, bundle ids, certificates, etc. The only things installed in the new project are
yarn add @react-native-firebase/app
and@react-native-firebase/messaging
On Android everything works. On iOS background and killed state messages are also working, but onMessage event is never fired when in Foreground 😢
I followed all the latest guides on https://reactnative.dev/docs/environment-setup , https://rnfirebase.io/ , https://rnfirebase.io/messaging/usage and https://rnfirebase.io/messaging/usage/ios-setup.
I am sending the notifications with AWS SNS, but it is the same when sending from the Firebase Console too.
Relevant part of the App.tsx:
In Podfile the following lines have been added:
Nothing has been changed in index.js
Project Files
Javascript
Click To Expand
package.json
:firebase.json
for react-native-firebase v6:# N/A
App.tsx
:iOS
Click To Expand
ios/Podfile
:AppDelegate.mm
:Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:// N/A
android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:e.g. 19.2.2
Firebase
module(s) you're using that has the issue:e.g. Messaging
TypeScript
?Y
&5.0.4
React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: