-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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_messaging] data message not triggering onMessage on foreground #29714
Comments
here is the solution @cgfischer @Khaibin |
I have the same problem with onMessage not being called on data messages under iOS. In all test cases the Android and iOS flutter app is running in foreground. Messages with the "notification" work fine on both Android and iOS but when I remove the notification element and send just a "data" message, then the iOS application does not receive the onMessage callback. In my case I am using python on my back-end server to publish notification messages. The python code looks like:
Everything works fine (iOS and Android receive onMessage callback) when the notification parameter is passed into the Message constructor. When I comment out this parameter (as shown) then the iOS app stops receiving the onMessage callback. Here is my flutter doctor output:
Here is my pubspec.yaml:
|
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Everything works perfectly fine when i send a notification message
JSON for notification message:
But onMessage event stops triggering when I send a data message (removing the notification key)
JSON for data message:
both getting success=1 from the google fcm response
This issue happens to me on iOS device (I don't have an Android device to test if it happens on Android)
I am using firebase_messaging 4.0.0+1
The text was updated successfully, but these errors were encountered: