Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

clearing ongoing notification in android

Tags:

android

In my application iam showing a ongoing notification while doing a video upload. I want to clear the notification after upload. I searched a lot and cant get a clear answer.Please help me if anybody knows...


1 Answers

From Managing your Notifications in android documentation:

You can also clear it manually with cancel(int), passing it the notification ID, or clear all your notifications with cancelAll().

So you should perform following to hide the notification:

mNotificationManager.cancel(notification_id);

where mNotificationManager is NotificationManager object and notification_id is int identifier of notification passed to NotificationManager object:

mNotificationManager.notify(notification_id, notification);
like image 94
Paweł Nadolski Avatar answered May 22 '26 03:05

Paweł Nadolski