-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Notifications triggers onMessage instead of onNotification #1900
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
Comments
Also, Firebase SDK version is 5.16.0. Libraries from Analytics and Messaging have been added to the app. |
This happens to me too as of today with iOS. The most that I could get to work is onMessage, and right now not even onMessage triggers. On Android works as expected tho. |
This happens to me as well in android - only onMessage works for me, notification events don't |
Yesterday I could solve the issue for iOS and I found out that this was missing in the Firebase Console (https://firebase.google.com/docs/cloud-messaging/ios/first-message#upload_your_apns_authentication_key) @yjacobowitz - For me Android gave me no trouble at all. Have you followed the setup process for Notifications too for react-native-firebase? (https://rnfirebase.io/docs/v5.x.x/notifications/android) |
Yes I realized now I missed one step and it works, is there a way to know when the notification is received (in background/closed) even if the user doesn't open it? |
I think that the only time you have to handle notifications is on the foreground. On the background you have the option to send messages: (Android only) https://rnfirebase.io/docs/v5.x.x/messaging/receiving-messages#4)-(Optional)(Android-only)-Listen-for-FCM-messages-in-the-background Hope it helps. |
Messages works without APN's configuration, did you checked your apple certificates? Another aspect you can test is reconfigure FCM in console panel, this worked for me. Hugs, |
Hello 👋, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions. |
+1.
My ios app could be received message but not push notification (message included apns such above). |
Hi, |
any update? I have the same issue on IOS onNotification and onNotificationDisplayed are not triggered. |
@mi-mazouz what versions of everything? react-native-firebase 5.3.1 works with pods 5.20.2, or are you not using pods? which versions of ios does it happen on? There's a reason for the new issue template :-) |
@mikehardy Sorry I didn't give you any information, so I use the react-native-firebase latest version (5.3.1), pod and the firebase messing version is my code looks like:
onMessage is the only listener triggered when I send a notification via firebase cloud messaging even in background or when the app is closed |
that is certainly more to work with :-), I am literally testing these exact things in my app now, I'll let you know what I see |
@mikehardy any news? |
At the moment I have multiple failures, and I think the best thing is to create a small repo to cleanly reproduce them. I'm not seeing onNotificationOpened consistently, getInitialNotification isn't populating correctly, etc. And this library in general has a mountain of issues related to notifications and messaging that are all subtle because setups are so different - seems like each thing is working for someone, but everyone has a problem with something else... So first I just want to prove (to myself, but also demonstrably to anyone) that it is possible and/or open issues if not. Not a concrete result for you, sorry. |
I'll open a new issue |
May my case provide some cues. FOUR weird things,
|
Hey, so I have the same issue when using a third party services, example: http://pushtry.com/ , and what is triggered is firebase.messaging().onMessage Might this be related to the native setup? Or might it be the standard behavior? if so how should this be dealt with? With firebase-admin "firebase.messaging().sendToDevice(fcmToken, notification, options)" on my back-end does send the native notification Also using fcm or gcm mode it also triggers on iOS the onMessage. |
For those having notification listener issues - if you integrated react-native-splash-screen following the most popular tutorial that has you use a separate LaunchActivity, that's the root cause here. I have all my listeners working correctly on android now following the code I pasted in the related issue here: crazycodeboy/react-native-splash-screen#289 - I believe iOS is working as well so I'm not aware of any more issues related to the module functioning. Its easy for project code to be wrong or for your messages to be not correct though - it is very hard to get these things correct. |
I believe messaging and notifications (please be careful! In Firebase-land they mean different things - messaging is cloud stuff, notification is device pop-up stuff) are working in the general case, i.e., the original issue here. If you are still having problems please please please open a new issue and follow the template |
I am facing same issue. When i send notification on iOS it triggers
podfile
APNs certificates added on firebase settings as well. Nothing seems to work. |
i'm facing same issue and i'm walking around until 5 hours. I'm trying same code on android and onNotification listener works but on iOS only onMessage listener work. This make me crazy!! Finally i've tried on real iOS device and everything works... If you trying launch app on ios simulator for foreground notifications, please try on real device. |
@srknzcn push notifications does not work on ios simulator. Apple does not support it. |
yes same issue, I am already facing is there any genuine solution to fix this problem. |
iOS onNotification() still not triggered. Instead onMessage() is. Then, iOS can receive notification only if the app is opened. I've tried to reconfigure APNs Authentication Key and APNs Certificates and even remove them from FCM console, the result is same. Note that I tried on real iPhones which ever worked some days ago. |
I am having the same issue as well. |
@batmaster have your figured out what the problem is ? |
Same issue. (About iOS) Yesterday, when I was setting a project for iOS, I had this issue, but I resolved it by uploading APNS Auth token to FCM Console. Notifications were working on every scenario. But today, I don't know why it only triggers onMessage again... |
Same here :| |
I struggled for hours with this issue after my (iOS) push notifications inexplicably stopped working, then finally solved it. First, have a look here: #1203 (comment) The extra step that made it work for me was adding
as the very last line before "return YES;" in didFinishLaunchingWithOptions. Note that I also had the block of extra code above ( |
resolved by thanks a lot |
Issue
When sending push notifications with only the "notification" field with "title" and "body" inside, I would expect the notification to be automatically displayed and onNotification to be triggered. Instead nothing is displayed and onMessage is triggered with an empty "data" object. I have only tried iOS so far, not Android yet.
Project Files
iOS
ios/Podfile
:# N/A
AppDelegate.m
:Android
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
iOS 12.1.4
10.14.3
N/A
N/A
Xcode 10.1
React Native
version:0.57.8
React Native Firebase
library version:5.2.2
Firebase
module(s) you're using that has the issue:TypeScript
?N/A
ExpoKit
?ExpoKit
N/A
I have verified that the app has asked for permission and that a token exists. This is the code that I am using in React Native to see which triggers are triggered:
This is the way I send a notification - I have also tried to send from the Firebase console with the same effect, only onMessage is triggered:
Think
react-native-firebase
is great? Please consider supporting the project with any of the below:React Native Firebase
andInvertase
on TwitterThe text was updated successfully, but these errors were encountered: