I am not sure whether this is entirely possible but I'll state my requirement. If it is possible then kindly help me figure out how to do it.
Let's say I have a gallery kind of an android app. When the user likes or comments on a photo in the gallery, We'd trigger an fcm notification using the code given below
value++;
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.notification)
.setLargeIcon(rawBitmap)
.setContentTitle("MyApp")
.setContentText(ContentText)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setDefaults(Notification.DEFAULT_SOUND)
.setStyle(new NotificationCompat.BigTextStyle().bigText(ContentText))
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(value, notificationBuilder.build());
By adding InboxStyle we can group notifcations into a single one and just increase the count.(For e.g. You have 5 notifications)
NotificationCompat.InboxStyle inboxStyle =
new NotificationCompat.InboxStyle();
// Sets a title for the Inbox in expanded layout
inboxStyle.setBigContentTitle("Title - Notification");
inboxStyle.setSummaryText("You have "+value+" Notifications.");
notificationBuilder.setStyle(inboxStyle);
But my requirement is like separate grouping for separate photos. If the user leaves 2 comments each for 3 photos. I need three groups of notifications to be listed. More like you have 2 comments on this photo,2 on this and so on.
I'll be receiving unique ids for the photos,if that helps.
How long will the id be retained?
Let's assume the user drops 2 comments on photo with id 001 and the partner receives the notification as a group .
What happens when the user drops another 2 comments on photo with id 002?
Will there be 2 groups?
Because a group of notification with id 001 remains untouched.