Android: varias notificaciones como lista única en la barra de estado

Estoy tratando de Notify usuario basado en algunos criterios. Multiple Notifications se muestran en la Status Bar pero quiero Group the notification in single notification y cuando el usuario hace clic en la Status Bar , quiero recuperar todas las notificaciones de ese grupo. ¿Es eso posible? O tengo que mantener PendingIntents de esas notificaciones? Cualquier ayuda será apreciada. Por ejemplo, si los cumpleaños de dos amigos vienen el mismo día, entonces se deben mostrar 2 notificaciones. Quiero combinar estas notificaciones es decir, en lugar de 2 notificaciones en la barra de estado, quiero uno, cuando el usuario hace clic en él, debe tener información acerca de 2 notificaciones. ¿Es posible?

Consulte el código que aparece a continuación para mostrar las notificaciones.

 public void displayNotification(BirthdayDetail detail) { NotificationCompat.Builder builder = new NotificationCompat.Builder(this.context); builder.setSmallIcon(R.drawable.ic_launcher); builder.setContentTitle(detail.getContactName()); builder.setContentText(detail.getContactBirthDate()); Intent resultIntent = new Intent(this.context, NotificationView.class); resultIntent.putExtra("name", detail.getContactName()); resultIntent.putExtra("birthdate", detail.getContactBDate()); resultIntent.putExtra("picture_path", detail.getPicturePath()); resultIntent.putExtra("isContact", detail.isFromContact()); resultIntent.putExtra("notificationId", notificationId); if(detail.isFromContact()) { resultIntent.putExtra("phone_number", detail.getPhoneNumber()); } PendingIntent resultPendingIntent = PendingIntent.getActivity(this.context, requestCode++, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(resultPendingIntent); notificationManager = (NotificationManager) this.context.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(notificationId, builder.build()); notificationId++; } 

Cuando necesite enviar una notificación varias veces para el mismo tipo de evento, debe evitar hacer una notificación completamente nueva. En su lugar, debe considerar actualizar una notificación anterior, ya sea cambiando algunos de sus valores o añadiéndole, o ambos.

Puedes usar algo como:

 mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); // Sets an ID for the notification, so it can be updated int notifyID = 1; mNotifyBuilder = new NotificationCompat.Builder(this) .setContentTitle("New Message") .setContentText("You've received new messages.") .setSmallIcon(R.drawable.ic_notify_status) numMessages = 0; // Start of a loop that processes data and then notifies the user ... mNotifyBuilder.setContentText(currentText) .setNumber(++numMessages); // Because the ID remains unchanged, the existing notification is // updated. mNotificationManager.notify( notifyID, mNotifyBuilder.build()); 

Fuente: http://developer.android.com/training/notify-user/managing.html

  • Cómo crear un icono de barra de estado en el lado derecho? (Androide)
  • NotificationManager obtener notificación por Id
  • Barra de búsqueda de Android en la barra de estado
  • StatusBarNotification cómo obtener datos o reenviar la intención?
  • Android - administrador de notificaciones, tener una notificación sin intención
  • No se puede encontrar el símbolo NOTIFICATION_SERVICE?
  • GCM push notificación. Notificación incorrecta publicada - No se pudo expandir RemoteViews para: StatusBarNotification
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.