0
Код ниже работает со мной с точки зрения создания уведомления с его голосом и действиями.Группировка уведомлений на Android
но выглядит .setGroup(GROUP_KEY_Fonix)
не работает, так как уведомления не сгруппированы вместе, я что-то пропустил!
public int notificationID = 0;
final static String GROUP_KEY_Fonix = "fonix_notification";
private void Notify(String notificationTitle, String notificationMessage){
notificationID++;
Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
// intent triggered, you can add other intent for other actions
Intent intent = new Intent(MainActivity.this, NotificationView.class);
PendingIntent pIntent = PendingIntent.getActivity(MainActivity.this, 0, intent, 0);
// Build the notification, setting the group appropriately
Notification notif = new NotificationCompat.Builder(this)
.setGroup(GROUP_KEY_Fonix)
.setContentTitle("New note: " + notificationTitle)
.setContentText(notificationMessage)
.setSmallIcon(R.drawable.ic_stat_new_message)
.setContentIntent(pIntent)
.setSound(soundUri)
.addAction(R.drawable.ic_stat_new_message, "View", pIntent)
.addAction(0, "Remind", pIntent)
.build();
// Issue the notification
NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(this);
// hide the notification after its selected
notif.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(notificationID, notif);
}