Describe the bug
While creating the Messaging App. If the User is not on the App and gets the message from the other device, the device receiving notifications but getting different notifications for each message for the same user. There is no such option to group/combine notifications & cancel the old notifications with the new one.
Also, as these things are managed by the library itself, is there any option to change the id of the notification?
Expected behavior
There should be a method to assign notification id particular to each notification message when the app is in the background and when the same kind of notification received again by the user, there should be a mechanism to handle the same.
Additional context
Any help would be greatly appreciated.
You can pass in a notification id in the data payload.
I am pretty sure you can write a function to remove old notifications with NotificationManager.
https://github.com/flutter/flutter/issues/25030
TechnicalBird, how do you call Local Notification Package and use other variables when using onBackgroundMessage?
yes @technicalbird how do you call local notification package when using onBackgroundMessage, i always got error Unhandled Exception: MissingPluginException
It seems multiple issues have been raised around this, I think this seems like a good issue to comment on as it's still open? I'm implementing notifications (not messaging) on an app using Firebase Cloud Messaging on Flutter, and I'd like to be able to group notifications received in the background. I'm not entirely clear on why setting the Android Notification Channel in the compose screen on FCM on the Firebase Console doesn't lead to this happening as my understanding of these things was that having the same channel would lead to Android automatically grouping the notifications, but perhaps not.
This seems to be a pretty basic requirement for any notification library, lacking it makes Firebase Cloud Messaging have very limited usefulness to developers.
Any clarity on how to achieve grouped background notifications or updates to the library to provide this functionality would be greatly appreciated.
Expected behavior
There should be a method to assign notification id particular to each notification message when the app is in the background and when the same kind of notification received again by the user, there should be a mechanism to handle the same.
Why any of the contributors did not respond this? Can we expect the behavior explained?
Expected behavior
There should be a method to assign notification id particular to each notification message when the app is in the background and when the same kind of notification received again by the user, there should be a mechanism to handle the same.Why any of the contributors did not respond this? Can we expect the behavior explained?
they don't know how to do it. 😂
For this you should specify either a collapseKey for Android or a threadId for Apple when sending your notification from your backend service. E.g. with the Firebase Admin SDK for Node.js this would look something like:
await admin.messaging().send({
token: 'YOUR_TOKEN_HERE',
apns: {
payload: {
aps: {
threadId: 'foo',
alert: 'Hello world',
},
},
},
android: {
notification: {
collapseKey: 'foo',
title: 'Hello world',
},
},
});
‘collapseKey’ is not group. Don’t close without testing
Group notification https://developer.android.com/training/notify-user/group
I closed due to my comment here: https://github.com/FirebaseExtended/flutterfire/issues/1770#issuecomment-722285841; specifically:
For the full style though on Android you need to create notifications using the Inbox Style notification style. For this I'd recommend sending data only messages through FCM and then using a local notifications plugin to build an Inbox Style notification from your FCM message data.
Most helpful comment
It seems multiple issues have been raised around this, I think this seems like a good issue to comment on as it's still open? I'm implementing notifications (not messaging) on an app using Firebase Cloud Messaging on Flutter, and I'd like to be able to group notifications received in the background. I'm not entirely clear on why setting the Android Notification Channel in the compose screen on FCM on the Firebase Console doesn't lead to this happening as my understanding of these things was that having the same channel would lead to Android automatically grouping the notifications, but perhaps not.
This seems to be a pretty basic requirement for any notification library, lacking it makes Firebase Cloud Messaging have very limited usefulness to developers.
Any clarity on how to achieve grouped background notifications or updates to the library to provide this functionality would be greatly appreciated.