tôi đã tạo ra một thông báo trên thanh trạng thái ở android lập trình sử dụng mã đưa ra dưới đây với một id riêngLàm thế nào để bỏ/Hủy bỏ thông báo trên thanh trạng thái ở android trình
Notification notification;
public static NotificationManager myNotificationManager;
public static final int NOTIFICATION_ID = 1;
private static void createStatusBarNotification(Context context,CharSequence NotificationTicket, CharSequence NotificationTitle,CharSequence NotificationContent, int icon) {
myNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
long when = System.currentTimeMillis();
notification = new Notification(icon, NotificationTicket, when);
Intent notificationIntent = new Intent(context, MyActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,notificationIntent, 0);
notification.setLatestEventInfo(context, NotificationTitle,NotificationContent, contentIntent);
notification.flags |= Notification.FLAG_ONGOING_EVENT;
myNotificationManager.notify(NOTIFICATION_ID, notification);
}
Bây giờ những gì tôi muốn là loại bỏ thông báo này trên nhấp vào một nút trong ứng dụng tha lập trình.
Làm cách nào tôi có thể đạt được điều này?
Đây là những gì tôi muốn :) – styler1972