Certaines applications ont des notifications qui ne peuvent être ignorées en les balayant.
Comment puis-je gérer un tel comportement?
En plus d’Andro Selvas, répondez:
Si vous utilisez le NotificationCompat.Builder , utilisez simplement
builder.setOngoing(true);
Utilisez le drapeau FLAG_ONGOING_EVENT
pour le rendre persistant.
Notification notification = new Notification(icon, tickerText, when); notification.flags = Notification.FLAG_ONGOING_EVENT;
Aussi, vous pouvez vérifier, FLAG_NO_CLEAR
J’ai utilisé le code ci-dessous pour que ma notification soit persistante:
startForeground (yourNotificationId, notificationObject);
Pour le rendre rejetable, faites simplement ce qui suit:
stopForeground (true);