如何將我的通知設置爲在點擊時清除自己?如何設置通知以在點擊時自行清除?
我設置autoCancel(true)
,但它不工作
我的代碼:
Notification n = new Notification.Builder(this)
.setContentTitle("Update for you")
.setContentText("Please click here to see the update information")
.setLargeIcon(BitmapFactory.decodeResource(this.getResources(),
R.drawable.ic_launcher))
.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(pList)
.setAutoCancel(true)
.addAction(R.drawable.ic_read, "Read", pRead)
.addAction(R.drawable.ic_list, "All Updates", pList)
.build();
NotificationManager notificationManager =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, n);
謝謝您的回答,我要測試,但我不
NotificationCompat.Builder
類知道爲什麼有時候我的通知顯示,但有時不:( – user2790880