Group Notifications using flutter_local_notifications package (android)

Viewed 35

I am building a mobile app using flutter and I a struggling with grouping the notifications on android. I have it working fine on ios but not on android. Here is the code I am working with below for groupchats:

flutterLocalNotificationsPlugin.show(
          notificationId++,
          response.message.text == '' ? 'Message from ${response.message.user?.name} in liveroom'
              : '${response.message.user?.name} in liveroom',
          response.message.text,
          NotificationDetails(
              android: AndroidNotificationDetails(
                cid,
                cid,
                groupKey: cid,
                channelDescription: cid,
              ),
              iOS: IOSNotificationDetails(
                  threadIdentifier: cid
              )
          ),
        );

And here is the code i am working with for one on one messaging:

flutterLocalNotificationsPlugin.show(
          notificationId++,
          response.message.text == '' ? 'Message from ${response.message.user?.name}'
              : '${response.message.user?.name}',
          response.message.text,
          NotificationDetails(
              android: AndroidNotificationDetails(
                cid,
                cid,
                groupKey: cid,
                channelDescription: cid,
                  setAsGroupSummary: true
              ),
              iOS: IOSNotificationDetails(
                  threadIdentifier: response.message.user?.name
              )
          ),
        );

The cid is the channel id and it unique for each group chat. It is also unique for each message thread between two people. I am trying to collapse the notifications from one person into one group. And also collapse the notifications from one group chat into one group (this is the behvaiour on ios based on the code above and i would like to replicate for android).

0 Answers
Related