Điều này là có thể nhưng cách bạn triển khai tùy thuộc vào cấp API bạn phát triển.
Đối với các cấp API dưới 11, bạn có thể đặt Notification.FLAG_NO_CLEAR. Điều này có thể được thực hiện như thế này:
// Create notification
Notification note = new Notification(R.drawable.your_icon, "Example notification", System.currentTimeMillis());
// Set notification message
note.setLatestEventInfo(context, "Some text", "Some more text", clickIntent);
// THIS LINE IS THE IMPORTANT ONE
// This notification will not be cleared by swiping or by pressing "Clear all"
note.flags |= Notification.FLAG_NO_CLEAR;
Đối với các cấp API trên 11, hoặc khi sử dụng Android Support Library, người ta có thể thực hiện nó như thế này:
Notification noti = new Notification.Builder(mContext)
.setContentTitle("Notification title")
.setContentText("Notification content")
.setSmallIcon(R.drawable.yourIcon)
.setLargeIcon(R.drawable.yourBigIcon)
.setOngoing(true) // Again, THIS is the important line
.build();
Khi kết hợp với bài đăng của antew, tôi đã tìm kiếm thông báo chính xác.FLAG_ONGOING_EVENT. Cảm ơn rất nhiều – Kelib