Firebase Messaging - iOS background notification onBackgroundMessage() not triggering #11225
Unanswered
RyanMannix
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I've gone through the "Submit a background notification" issue template, and the only thing I haven't done is tested on a physical device... so it's possible that's the reason. Will be able to test on a hard device early next week. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, I have looked through many discussions and issues here, and I see that there are a lot of users experiencing difficulties with iOS background messages. I have a problem getting
onBackgroundMessage()
to trigger when receiving a notification when app is minimized. Thank you in advance for any help 🙏I have a golang FCM server which is sending notifications to FCM, which is then sending them out to user devices. This process works correctly - notifications are delivered successfully.
Flutter app (iOS/Android) is running
firebase_messaging: ^14.4.0
Golang FCM server is running
firebase.google.com/go/v4 v4.11.0
Simulator - iOS version 16.4
I have some logic (saving notification to local storage) that I'd like to trigger upon receipt of that notification. This works 100% for android. For iOS, it works when notification is received in the foreground. If the app is minimized (not swipe closed) it does not trigger the
onBackgroundMessage(myBackgroundMessageHandler)
method so it never writes to file.Background Handler looks like this:
I can't really dig into that notification to see what the values are (since
firebase.onBackgroundMessage(myBackgroundMessageHandler)
is never actually called from iOS, but in android the output is like this:a: false, b: null, c: 0:1688586103618334%9238a8c09238a8c0, d: {path: /friends}, e: Instance of 'RemoteNotification'
a
in this case is ContentAvailable, which I'm explicitly setting for APNS in the go server (below), so in theory iOS would look identical justtrue
for ContentAvailable.This is what my golang server is sending:
So I believe that the ContentAvailable value must be set to true. I'm missing something else about the formatting of the notification values for the
onBackgroundMessage()
to be triggered. If anyone can help it'd be greatly appreciate.Beta Was this translation helpful? Give feedback.
All reactions