有没有办法让用户在没有按下按钮的情况下清除通知?我已经设置了 setAutoCancel(false) 并且没关系,但是有一个按钮可以清除所有通知,我不希望它清除我的通知,因为它对用户很重要,他必须阅读它并选择一个操作。
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());