thomasgalliker / Plugin.FirebasePushNotifications

Receive and handle firebase push notifications in .NET MAUI apps
MIT License
53 stars 5 forks source link

[Enhancement] Create Channels Group #56

Open eyeveye opened 3 weeks ago

eyeveye commented 3 weeks ago

Summary

For Android to be able to group the channels into group.

thomasgalliker commented 3 weeks ago

Can you provide some more info, so I dont have to do the research work. I have never used channel groups before.

eyeveye commented 3 weeks ago

Hi,

Currently my code as follow:

I am using Plugin.Firebase.CloudMessaging. As you can see, there is a group called "Latest Result" which is the group for the rest of the channel.

private void CreateNotificationChannel() {

    notificationManager.CreateNotificationChannelGroup(new NotificationChannelGroup(NotificationConstants.NOTIFICATION_LATEST_RESULT_GROUP_CHANNEL_ID, "Latest Result"));

    notificationManager.CreateNotificationChannel(new NotificationChannel(
    NotificationConstants.NOTIFICATION_LATEST_4D_CHANNEL_ID,
    "4D",
    NotificationImportance.High)
    { Group = NotificationConstants.NOTIFICATION_LATEST_RESULT_GROUP_CHANNEL_ID });

    notificationManager.CreateNotificationChannel(new NotificationChannel(
    NotificationConstants.NOTIFICATION_LATEST_TOTO_CHANNEL_ID,
    "TOTO",
    NotificationImportance.High)
    { Group = NotificationConstants.NOTIFICATION_LATEST_RESULT_GROUP_CHANNEL_ID });

    notificationManager.CreateNotificationChannel(new NotificationChannel(
    NotificationConstants.NOTIFICATION_LATEST_SWEEP_CHANNEL_ID,
    "SWEEP",
    NotificationImportance.High)
    { Group = NotificationConstants.NOTIFICATION_LATEST_RESULT_GROUP_CHANNEL_ID });

}

In Android App Notification Settings it will show as such: image

thomasgalliker commented 3 weeks ago

I‘ll have a look at it.