You can try this quick code
public static void cancelNotification(Context ctx, int notifyId) {
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager nMgr = (NotificationManager) ctx.getSystemService(ns);
nMgr.cancel(notifyId);
}
More Related Contents:
- How to display count of notifications in app launcher icon [duplicate]
- How to send parameters from a notification-click to an activity?
- Actionbar notification count icon (badge) like Google has
- Notification to restore a task rather than a specific activity?
- Notification click: activity already open
- How to create a notification with NotificationCompat.Builder?
- Firebase (FCM): open activity and pass data on notification click. android
- Detect a new Android notification
- How to play an android notification sound
- How to make notification intent resume rather than making a new intent?
- catch on swipe to dismiss event
- Handling buttons inside android notifications
- Android: How to create an “Ongoing” notification?
- android: running a background task using AlarmManager
- Android – Build a notification, TaskStackBuilder.addParentStack not working
- How to display multiple notifications in android
- Disable sound from NotificationChannel
- android pending intent notification problem
- How to execute a method by clicking a notification
- On Android 8.1 API 27 notification does not display
- How to set the app icon as the notification icon in the notification drawer
- Android foreground service notification not showing
- open a specific activity from firebase notification
- Adding onClick Action To Button In Notification
- NotificationCompat.Builder doesn’t accept 2nd argument
- How to add button to notifications in android?
- Starting app only if its not currently running
- Is possible set Expanded Notification as default in Big Text Notifications?
- Extract notification text from parcelable, contentView or contentIntent
- Check for access to notifications using NotificationListenerService