Reputation: 2292
There is a way that don't let user clear the notification without press button inside her? I already set setAutoCancel(false) and it's ok, but there is a button that clear all notifications and I don't want it clear my notification cause it's important to user and he has to read it and choose an action.
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.icon)
.setContentTitle("Sync Failed")
.setContentText("Lorem ipsum dolor sit amet")
.setStyle(new NotificationCompat.BigTextStyle().bigText("Lorem ipsum dolor sit amet"))
.addAction(R.drawable.change, "Change Pass", pChangePass)
.addAction(R.drawable.remove, "Ignore", pIgnore)
.setAutoCancel(false);
mNotificationManager.notify(accountUnique, builder.build());
Upvotes: 5
Views: 4317
Reputation: 14590
For that change your last three lines code like this..
final Notification notification = builder.build();
notification.flags = Notification.FLAG_NO_CLEAR;
mNotificationManager.notify(accountUnique, notification);
Upvotes: 1