¿Es posible configurar la notificación ampliada como predeterminada en las notificaciones de texto grande?
He seguido este ejemplo de código
En la sección de Big Text Notifications
, dijo que la necesidad de ampliar para ver la forma de Big text notification
, como imagen im a continuación:
- Cordova PushPlugin - No se puede recibir notificación de GCM en android si la aplicación no se está ejecutando
- Notificación Acción sin iniciar nueva Actividad?
- Cómo comprobar si mi aplicación tiene permiso para mostrar la notificación
- Icono de notificación en blanco para Android con Phonegap Build y PushPlugin
- Problema pendiente de notificación de Android android
Me pregunto que no podemos set Expanded Notification as default in Big Text Notifications?
La gente que lo sabe es puede o no,
Si puede,
Por favor, dime cómo hacerlo,
Gracias,
- Problema de notificaciones push de Parse.com. Anular la suscripción no funciona, sigue recibiendo notificaciones push (Android).
- ¿Cómo puedo mantener la notificación de Android abierta hasta que se cierre mi aplicación?
- RemoteView no muestra botones en la notificación personalizada
- La notificación abre actividad, se pulsa el botón de retroceso, se abre la actividad principal?
- Android: ejecutando una tarea de fondo con AlarmManager
- Notificación de notificación de Android O no publicada en el canal, pero es
- Notificaciones de Android: tienen colores en un icono pequeño
- Android Cómo abrir la última actividad al hacer tapping en la notificación
La documentación establece :
La vista grande de una notificación aparece sólo cuando se amplía la notificación, lo que ocurre cuando la notificación se encuentra en la parte superior del cajón de notificaciones o cuando el usuario expande la notificación con un gesto.
Así que mi respuesta es no, no se puede ampliar por defecto.
Sin embargo, hay un truco para empujar la notificación a la parte superior de la lista donde se ampliará. Simplemente establezca la prioridad de Notification.PRIORITY_MAX
y es probable que la notificación de su aplicación llegue a la parte superior.
Notification noti = new Notification.Builder() ... // The same notification properties as the others .setStyle(new Notification.BigPictureStyle().bigPicture(mBitmap)) .build();
Tú cambias
.setStyle(new NotificationCompat.BigTextStyle().bigText(th_alert))
Junto con el anuncio
notification = new NotificationCompat.Builder(context)
Aquí hay un ejemplo:
Puede configurar Código
Intent intent = new Intent(context, ReserveStatusActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); intent = new Intent(String.valueOf(PushActivity.class)); intent.putExtra("message", MESSAGE); TaskStackBuilder stackBuilder = TaskStackBuilder.create(context); stackBuilder.addParentStack(PushActivity.class); stackBuilder.addNextIntent(intent); // PendingIntent pendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT); // android.support.v4.app.NotificationCompat.BigTextStyle bigStyle = new NotificationCompat.BigTextStyle(); // bigStyle.bigText((CharSequence) context); notification = new NotificationCompat.Builder(context) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle(th_title) .setContentText(th_alert) .setAutoCancel(true) // .setStyle(new Notification.BigTextStyle().bigText(th_alert) ตัวเก่า // .setStyle(new NotificationCompat.BigTextStyle().bigText(th_title)) .setStyle(new NotificationCompat.BigTextStyle().bigText(th_alert)) .setContentIntent(pendingIntent) .setNumber(++numMessages) .build(); notification.sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); notificationManager.notify(1000, notification);