You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Firebase Messaging library appears to not handle data messages. Data messages are converted to notification messages as part of the remote message parsing that the library does after receiving the notification from firebase.
Steps to reproduce
Steps to reproduce the behavior:
Add firebase_messaging library to project and configure
Put the app in the background
Send a data notification to the app. I am using this to send the push:
The above data notification is attempted to be delivered to the system tray as a notification message type, but it fails with this error:
NoSuchMethodError: The method 'call' was called on null.
Receiver: null
Tried calling: call(_LinkedHashMap len:1)
If I foreground the app and send the notification again, this is what I get back in the onMessage callback. {notification: {title: null, body: null}, data: {foobar: bazbar}}
This payload shouldn't have a notification key within the payload. This is why the logs display an error when the app is backgrounded. The system is trying to create a notification with null body/title. Looks like the Firebase Messaging library is adding the notification key, even when the notification key is null in the message received from Firebase. I found what looks to be the culprit.
james-airspace
changed the title
🐛 [firebase_messaging] All incoming Firebase notifications are handled as notification type when plugin is registered
🐛 [firebase_messaging] All incoming Firebase notifications are handled as notification type
Sep 30, 2020
Bug report
Describe the bug
Firebase Messaging library appears to not handle data messages. Data messages are converted to notification messages as part of the remote message parsing that the library does after receiving the notification from firebase.
Steps to reproduce
Steps to reproduce the behavior:
The above data notification is attempted to be delivered to the system tray as a notification message type, but it fails with this error:
If I foreground the app and send the notification again, this is what I get back in the
onMessage
callback.{notification: {title: null, body: null}, data: {foobar: bazbar}}
This payload shouldn't have a notification key within the payload. This is why the logs display an error when the app is backgrounded. The system is trying to create a notification with null body/title. Looks like the Firebase Messaging library is adding the notification key, even when the notification key is null in the message received from Firebase. I found what looks to be the culprit.
https://github.com/FirebaseExtended/flutterfire/blob/master/packages/firebase_messaging/android/src/main/java/io/flutter/plugins/firebasemessaging/FirebaseMessagingPlugin.java#L135
Looks like the
parseRemoteMessage
function appends a notification object to the map, even whenremoteMessage.getNotification()
is null.Expected behavior
Data messages sent to the app with the plugin registered are still handled as data messages.
Branch with fix
https://github.com/james-airspace/flutterfire/tree/fix-3696
The text was updated successfully, but these errors were encountered: