-
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
[🐛] 🔥 Firebase notification is received but the callbacks are not triggered (workaround: opt out of google play services notification delegation) #8392
Comments
We have started getting similar reports from our Android users during the past week where notifications that they press on, just open the app and don't go where they are supposed to. We did update the react-native-firebase from version 21.4.0 to version 21.7.1 on last week's Monday so my initial thought was that it would be related to the update, but not sure if this is happening suddenly for other apps too 🤔 |
I believe this may be duplicate, and I have a comment here detailing how to go a little deeper with the investigation --> #8112 (comment) @soutua are you also seeing this from Samsung A14 users specifically, or all users? The message I link seems to be related to Android14+ not just Samsung A14 users (confusingly similar names, but hopefully I'm communicating clearly) My hypothesis is that this may be the new google play services version and notification proxy stuff. Note that this may be disabled with an AndroidManifest.xml tweak to test that hypothesis (@kerimamansaryyev if you have a good reproduction case for it, trying that AndroidManifest change to disable google play services notification proxy would be the first thing I'd check, followed by instrumenting the code in the areas I mention in the comment I link) |
Hi! We have gotten this feedback from users with the following devices: So it seems to be Android 14+ users at least by the feedback we have gotten. We haven't been able to reproduce this ourselves though. So in theory if we add this to our AndroidManifest.xml:
It would prevent it from using the new delegation system and avoid the problem? We could try that 🤔 We have around 1 million users who almost all use notifications so we'll see by the feedback if it fixes it or not 😅 |
Yes - that is my hypothesis. I haven't reproduced this personally so I cannot say one way or the other. But it will be a quick way to either focus in immediately on this specific area (notification proxy/delegate stuff from google play services) or the opposite to realize it isn't going to be the root cause and so focus effort somewhere else. Any results you get if you run that experiment on a population that will give a pretty certain answer, or if you reproduce the issue yourself and the change fixes it - would be very informative |
We have this issue on some Android 15 devices too. I was able to fix this problem on a Pixel 6 device with the above meta data entry in Another approach, as stated in the Google docs, can be to set the |
Really useful information @matthesjh thank you! I think we should be able to handle notifications that come in with the proxy stuff in use, but as mentioned above simply having some observed data that this is the area to focus on is really critical information, thanks So more experiment results are always useful to make sure the result is conclusive - anyone else experiencing this, if you add that key in AndroidManifest (requires a new build), or in your FCM body (just change your notification send logic server side), please chime in until we're certain we know this is it, and that there are good mitigation strategies |
I had already tried tapping the receiver and the services, the logcat didn't show any logs, hence I concluded that they are being ignored completely. I appreciate immediate attention to this issue. Seems like they rolled out the new Google Play services update on random Thursday :) I still have the reproducible code and the test device, so I will test the hypothesis with tweaking the proxy feature in |
I confirm that the issue has been resolved by applying the meta tag. I believe that people will appreciate it if this new Google Play Services update will be mentioned in |
Great news to get a second confirm on disabling the delegation being an effective workaround. Agreed a docs update can help, additionally at least until we understand how to handle the feature better I can add the ability to toggle the flag in firebase.json in the same way we allow the configuration of a few of the other tags, so at least this can be handled at build time, even for Expo folks who don't normally have access to that file. Okay - so for anyone else seeing this no response from the listeners / firebase methods in response to a notification tap: Follow the instructions here and pick a method you can implement to opt out for now: https://firebase.google.com/docs/cloud-messaging/android/message-priority#proxy |
By the way, although one of the methods states:
There is no such a property in the firebase admin SDK. I checked out the source code of Python and Java admin SDKs. There is no |
@mikehardy Do you know any centralized way to submit a feature request to Firebase Admin SDK rather than filling issues per repository? |
@kerimamansaryyev I'm not sure I follow. What issues would you be filing? Does firebase-admin-sdk not support sending that key and needs a fix to support sending the opt-out key in your FCM requests? Or, perhaps firebase-android-sdk to add some support somehow for whatever the notification Intent looks like when it comes from the delegation / proxy instead ? Or ? |
Yes, it's not supported by the admin SDKs, even though it's supported via Firebase REST API. I am asking, just in case if you know, how to deliver this issue to Firebase team more conveniently than filing a feature request to each of the admin SDK repos. |
Okay - understood @kerimamansaryyev - unfortunately, I am not aware of a way other than engaging via issues in the repositories for the specific things you need in each repository. |
I'm a flutter user, but I found this after weeks of troubleshooting. Thanks everybody in this thread. The AndroidManifest.xml fix didn't work for me, but updating the payload on the server side to include |
Hey @kerimamansaryyev does the solution provided by @austinwitherspoon solve things for you? |
I haven't tested out that particular solution because I am not using Firebase REST API but the admin SDK on Python, which doesn't yet support applying Also, I'm curious if it's possible to support both the Google Play Services notification delegation and handling notifications normally because I believe the one should not disrupt the other. From my observations, notifications, delivered upon the Google Play Services delegation, wouldn't be reported to the broadcast receiver declared in AndroidManifest.xml of this package. |
That's the only reason I've left the issue open - to investigate what the difference is in the Intent object the Android app receives for a delegated notification when tapped vs the non-delegated one. The known workaround of opting out (however you manage to do so) is sufficient for now, but ideally yes, these delegated notifications should be handled as well Alternatively, if there is no way to handle them then react-native-firebase needs a change to |
Another data point, setting proxy to "DENY" in the http protocol immediately fixed the issue for us. Including the modified code if someone wants a pointer on what to change:
|
Passar o proxy: "DENY" funcionou para mim. |
[MAINTAINER NOTE: the problem is with the new "notification delegation" feature rolled out in Google Play Services. The workaround is to opt out. There is a link to the Google doc with instructions on how to opt out in this comment - the AndroidManifest style and the FCM android / proxy deny key methods are both confirmed working, choose what works for you]
Issue
This issue was detected specifically on Samsung Galaxy A14 (running on Android 14).
Steps to reproduce:
0.76
and0.78
versions of React Native.@react-native-firebase/app
and@react-native-firebase/messaging
, follow corresponding SDK instructions.getInitialNotification
, listen toonMessage
,onNotificationOpenedApp
.onMessage
listener.onMessage
,onNotificationOpenedApp
)getInitialNotification
will always returnnull
From my investigation:
I tapped multiple locations from the source code of
@react-native-firebase/messaging
, and found out an issue withReactNativeFirebaseMessagingReceiver
andReactNativeFirebaseMessagingService
. Apparently, when you click on a native notification (received from background or quit state), it somehow affects on both the receiver and the service, so the receiver'sonReceived
method won't be called anymore nor the service'sonMessageReceived
will be triggered.I suppose that Samsung Galaxy A14 terminates the receiver and the service after you click on a notification. It's believed that Samsung devices may have quite aggressive power management which restricts background tasks and activities, however, even after turning off the optimizations and the restrictions, the issue has still persisted.
Here are some related threads from the Flutter repository:
Sample
App.tsx
:Project Files
Javascript
Click To Expand
package.json
:firebase.json
for react-native-firebase v6:# N/A
iOS
Click To Expand
ios/Podfile
:# N/A
AppDelegate.m
:// N/A
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
:android/app/build.gradle
:android/settings.gradle
:MainApplication.java
:AndroidManifest.xml
:Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:21.12.0
Firebase
module(s) you're using that has the issue:@react-native-firebase/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: