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.
- Barra de búsqueda de Android en la barra de estado
- ¿Cómo detectar si se ha rechazado una notificación?
- Notificación de cancelación automática no funciona para Android Lollipop
- NotificationManager.cancel (id) no funciona dentro de un receptor de difusión
- ¿Cómo usar la notificación con sonido y vibració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++; }
- StatusBarNotification cómo obtener datos o reenviar la intención?
- Android Remoteviews para notificaciones ampliadas
- Cómo crear un icono de barra de estado en el lado derecho? (Androide)
- Múltiples notificaciones para la misma actividad
- No se puede encontrar el símbolo NOTIFICATION_SERVICE?
- OnActivityResult para PendingIntent
- NotificationManager obtener notificación por Id
- Android - administrador de notificaciones, tener una notificación sin intenció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