不要让用户清除android通知?

Pol*_*ito 5 notifications android

有一种方法不让用户在没有按下按钮的情况下清除通知吗?我已经设置了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());
Run Code Online (Sandbox Code Playgroud)

Car*_*nal 18

.setOngoing(true) 
Run Code Online (Sandbox Code Playgroud)

还需要加入!