How to sort notifications by id ?
Can't find any option to do this but looks like it is possible in Android.
https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setSortKey(java.lang.String)
I did try to add builder.SetSortKey(request.NotificationId.ToString()); in NotificationServiceImpl.cs but it's still not sorting them by notification id.
Set a sort key that orders this notification among other notifications from the same package. This can be useful if an external sort was already applied and an app would like to preserve this. Notifications will be sorted lexicographically using this value, although providing different priorities in addition to providing sort key may cause this value to be ignored.
Hi, I am setting the same priority for all notifications, but they still don't get sorted.
Channel:
android.AddChannel(new NotificationChannelRequest
{
Id = $"my_channel_01",
Name = "Channel 1",
Description = "blablabla",
Importance = AndroidImportance.Low
});
Summary:
var notification = new NotificationRequest
{
NotificationId = 1,
Title = "appName",
ReturningData = "none",
Group = "appName",
Android =
{
IsGroupSummary = true,
ChannelId = "my_channel_01",
Ongoing = false,
AutoCancel = false,
Priority = AndroidPriority.Low
}
};
Notifications:
var notification = new NotificationRequest
{
NotificationId = getNotificationId(defaultPriority),
Title = "appName",
Subtitle = priorityNames[defaultPriority],
Description = notiText,
Group = "appName",
Android =
{
IconSmallName =
{
ResourceName = priorityIcons[defaultPriority]
},
IconLargeName =
{
ResourceName = priorityIcons[defaultPriority]
},
IsGroupSummary = false,
Ongoing = persistentNotification,
ChannelId = "my_channel_01",
AutoCancel = false,
Priority = AndroidPriority.Low
}
};

getNotificationId returns a number based on priority (high = 10000, medium = 20000, low = 30000)