Remove a notification
Notifications remain visible until one of the following happens:
- The user dismisses the notification.
- The user clicks the notification, and you called setAutoCancel() when you created the notification.
- You call cancel() for a specific notification ID. This method also deletes ongoing notifications.
- You call cancelAll(), which removes all of the notifications you previously issued.
- If you set a timeout when creating a notification using setTimeoutAfter(), the system cancels the notification after the specified duration elapses. If required, you can cancel a notification before the specified timeout duration elapses.
For more details see:
https://developer.android.com/training/notify-user/build-notification?hl=en