.setColor(context.getResources().getColor(R.color.colorNotificationMention)) .setDeleteIntent(dismissIntent) .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN); if (isLong) { PendingIntent intent = PendingIntent.getActivity(context, CHAT_SUMMARY_NOTIFICATION_ID,
notification .setGroup(NotificationManager.NOTIFICATION_GROUP_CHAT) .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN);
@RequiresApi(Build.VERSION_CODES.N) public void showNotificationGroup(long priority) { Intent intent = new Intent(this, MessagesActivity.class); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder b = new NotificationCompat.Builder( this, NotificationSupport.convertPriorityToChannel(priority)); b.setAutoCancel(true) .setDefaults(Notification.DEFAULT_ALL) .setWhen(System.currentTimeMillis()) .setSmallIcon(R.drawable.ic_gotify) .setTicker(getString(R.string.app_name)) .setGroup(NotificationSupport.Group.MESSAGES) .setGroupAlertBehavior(NotificationCompat.GROUP_ALERT_CHILDREN) .setContentTitle(getString(R.string.grouped_notification_text)) .setGroupSummary(true) .setContentText(getString(R.string.grouped_notification_text)) .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary)) .setContentIntent(contentIntent); NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(-5, b.build()); } }
@Override public NotificationBuilder setGroupAlertBehavior(final int groupAlertBehavior) { super.setGroupAlertBehavior(groupAlertBehavior); return this; }