Notificación de Android BigPictureStyle desaparición de texto
Estoy implementando notificaciones ricas de Android usando la biblioteca de compatibilidad, por lo que todas las notificaciones se están android.support.v4.app.NotificationCompat.Builder
utilizando android.support.v4.app.NotificationCompat.Builder
El código que estoy usando es el siguiente:
- Controles del reproductor de medios en la notificación
- Visualización de emojis en el contenido de la notificación
- BroadcastReceiver no funciona cuando la aplicación no se está ejecutando
- ANDROID: ¿Cómo puedo iniciar un diálogo emergente desde una notificación o un botón de búsqueda presionado encima de todas las ventanas?
- Android: ¿Cómo colapsar la barra de estado en android 4.2?
// Base notification NotificationCompat.Builder b = new NotificationCompat.Builder(context); b.setSmallIcon(R.drawable.ic_actionbar); b.setContentTitle(title); b.setContentText(Html.fromHtml(msg)); b.setTicker(title); b.setWhen(System.currentTimeMillis()); b.setDeleteIntent(getDismissNotificationsPendingIntent(quantity)); b.setLargeIcon(Picasso.with(context).load(iconUrl).get()); // BigPictureStyle NotificationCompat.BigPictureStyle s = new NotificationCompat.BigPictureStyle(); if (expandedIconUrl != null) { s.bigLargeIcon(Picasso.with(context).load(expandedIconUrl).get()); } else if (expandedIconResId > 0) { s.bigLargeIcon(BitmapFactory.decodeResource(context.getResources(), expandedIconResId)); } s.bigPicture(Picasso.with(context).load(bigImageUrl).get()); b.setStyle(s); b.setContentIntent( // some intent b.addAction(R.drawable.ic_notification_ // some action Notification n = b.build(); // and go ahead to show it
Hay un poco de extra básicamente no cargar ninguna imagen si mostrar imágenes no es compatible, por lo que no usamos la memoria sin razón, pero eso es la base y espero algo similar a la notificación a la derecha de la siguiente imagen
El problema es que el mensaje (en el ejemplo "Tocar para ver la captura de pantalla") muestra cuándo se ha contratado la notificación, pero cuando la notificación se expande, el mensaje desaparece.
¿Hay algún método setMessage()
que me olvide llamar? ¿Es un error con NotificationCompat
? ¿Puede alguien dar una idea aquí?
- Programo una notificación local en un momento específico, utilizando el conmutador, pero su activación no a tiempo establecido
- Ordenación de una parcela de notificación
- Notificaciones push iOS y código nativo cliente-cliente de Android
- El icono de la barra de notificaciones se vuelve blanco en Android 5 Lollipop
- Registro de identificación del dispositivo directamente con Amazon SNS
- Problema pendiente de notificación de Android android
- La notificación en curso en Android honeycomb tiene un comportamiento inconsistente
- Cómo crear una notificación con NotificationCompat.Builder?
¿Hay algún método setMessage () al que me olvide llamar?
¡Sí! NotificationCompat.BigPictureStyle setSummaryText
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.notify(0, setBigPictureStyleNotification()); private Notification setBigPictureStyleNotification() { Bitmap remote_picture = null; // Create the style object with BigPictureStyle subclass. NotificationCompat.BigPictureStyle notiStyle = new NotificationCompat.BigPictureStyle(); notiStyle.setBigContentTitle("Big Picture Expanded"); notiStyle.setSummaryText("Nice big picture."); try { remote_picture = BitmapFactory.decodeStream((InputStream) new URL(sample_url).getContent()); } catch (IOException e) { e.printStackTrace(); } // Add the big picture to the style. notiStyle.bigPicture(remote_picture); // Creates an explicit intent for an ResultActivity to receive. Intent resultIntent = new Intent(this, ResultActivity.class); // This ensures that the back button follows the recommended convention for the back key. TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); // Adds the back stack for the Intent (but not the Intent itself). stackBuilder.addParentStack(ResultActivity.class); // Adds the Intent that starts the Activity to the top of the stack. stackBuilder.addNextIntent(resultIntent); PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); return new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) .setAutoCancel(true) .setLargeIcon(remote_picture) .setContentIntent(resultPendingIntent) .addAction(R.drawable.ic_launcher, "One", resultPendingIntent) .addAction(R.drawable.ic_launcher, "Two", resultPendingIntent) .addAction(R.drawable.ic_launcher, "Three", resultPendingIntent) .setContentTitle("Big Picture Normal") .setContentText("This is an example of a Big Picture Style.") .setStyle(notiStyle).build(); }
- ¿Puedo usar CloudKit en Android o en una aplicación basada en Web?
- Carpeta de Android KitKat 4.4 en la tarjeta sd