Desactivación de la eliminación de notificaciones de Android
¿Es posible desactivar la función de eliminación de borrado de una notificación de android desde la lista de notificaciones de android. Por favor, ayúdame.
Gracias por adelantado.
- ¿Por qué se necesita NotificationCompat?
- Deshabilitar notificación de borrado para mi aplicación
- Ancho de notificación de Android
- Android Beep o Light sin un objeto de notificación?
- Prueba de notificaciones con pruebas unitarias
- ¿Cuáles son los tamaños de los iconos en los botones de acción de notificaciones de Android?
- Cómo reproducir un sonido de notificación de Android
- Cómo enviar la notificación del fcm al dispositivo múltiple en el reqest único del fcm
- Configuración de un icono de notificación de Android en una URL remota
- La notificación deleteIntent no funciona
- El método setPriority (int) no está definido para el tipo Notificación
- Los extras de intento se duplican cuando se utiliza FLAG_UPDATE_CURRENT en PendingIntent al crear notificaciones de android
- El icono de notificación de Android es un círculo blanco
Puede marcar su Notificación como una notificación "en curso".
-> Notification.Builder setOngoing
Prueba este código
builder.setOngoing(true); // Cant cancel your notification (except notificationManager.cancel(); )
Por encima del código en Notifcation Builder.
public void DisplayNotification() { // Use NotificationCompat.Builder to set up our notification. NotificationCompat.Builder builder = new NotificationCompat.Builder(this); //icon appears in device notification bar and right hand corner of notification builder.setSmallIcon(R.drawable.ic_stat_notification); // This intent is fired when notification is clicked Intent tapIntent = new Intent(CurrentActivity.this, SecondActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, tapIntent, 0); // Set the intent that will fire when the user taps the notification. builder.setContentIntent(pendingIntent); builder.setOngoing(true); // Cant cancel your notification (except NotificationManger.cancel(); ) // Content title, which appears in large type at the top of the notification builder.setContentTitle("Notifications Title"); // Content text, which appears in smaller text below the title builder.setContentText("Your notification content here."); NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // Will display the notification in the notification bar notificationManager.notify(NOTIFICATION_ID, builder.build()); }
Cancelar notificación
public void cancelNotification() { mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mNotificationManager.cancel(NOTIFICATION_ID); // Notification ID to cancel }
Codificación feliz