2

I'm currently showing notification with this:

NotificationCompat.Builder noBuilder = new NotificationCompat.Builder(this)
    .setSound(sound)
    .setSmallIcon(R.drawable.h) 
    .setLargeIcon(largeIcon)
    .setContentTitle(title)
    .setFullScreenIntent(pendingIntent,true)
    .setContentText(message)
    .setStyle(new NotificationCompat.BigTextStyle()
    .bigText(message))
    .setAutoCancel(true)
    .setPriority(Notification.PRIORITY_HIGH)
    .setContentIntent(pendingIntent);
Sufian
  • 6,405
  • 16
  • 66
  • 120
felix
  • 651
  • 1
  • 6
  • 12

1 Answers1

6

Use setGroup() key to show notifications in group.

final static String GROUP_KEY_EMAILS = "group_key_emails";

// Build the notification, setting the group appropriately
Notification notif = new NotificationCompat.Builder(mContext)
         .setContentTitle("New mail from " + sender1)
         .setContentText(subject1)
         .setSmallIcon(R.drawable.new_mail)
         .setGroup(GROUP_KEY_EMAILS)
         .build();

// Issue the notification
NotificationManagerCompat notificationManager =
        NotificationManagerCompat.from(this);
notificationManager.notify(notificationId1, notif);

Set setGroupSummary() to set summary for a group of notifications

Sufian
  • 6,405
  • 16
  • 66
  • 120
Rohan Pawar
  • 1,875
  • 22
  • 40