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.
- NotificationManager.cancel (id) no funciona dentro de un receptor de difusión
- OnActivityResult para PendingIntent
- Notificación de cancelación automática no funciona para Android Lollipop
- La lista de animación se reiniciará cuando actualice notificaciones (NotificationManager.notify) en Lollipop
- ¿Cómo detectar si se ha rechazado una notificación?
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++; }
- ¿Cómo borrar correctamente toda la notificación una vez hecho clic?
- NotificationManager.cancel () no funciona para mí
- Cómo implementar el servicio de notificación (no utilizar la actividad) en android
- Android Remoteviews para notificaciones ampliadas
- ¿Cómo establecer el detector de clics para la notificación?
- ¿Cómo usar la notificación con sonido y vibración?
- Múltiples notificaciones para la misma actividad
- En Android, ¿cómo puedo saber el ID de notificación actual para borrar la notificación
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
- Android: ViewPager FragmentStatePagerAdapter obtener la vista actual
- Crea una barra lateral como el navegador Dolphin o Firefox en android