If you generate a notification from a service running in the foreground using
startForeground(NOTIFICATION_ID, notificationBuilder.build());
Then issuing
notificationManager.cancel(NOTIFICATION_ID);
does not cancel the Notification, and the notification still appears in the status bar. In this particular case, you will need to release
stopForeground( true );
from the service to return it to the background while canceling notifications. Alternatively, you can push it into the background without canceling the notification and then canceling the notification.
stopForeground( false ); notificationManager.cancel(NOTIFICATION_ID);
Ian Gough 09 Oct '15 at 20:52 2015-10-09 20:52
source share