rohitkg
rohitkg

Reputation: 33

Clearing notifications from any of the activities in my android app

Suppose there are 2 activities in my app named Act1 and Act 2. Now, Act1, when closes, sends a status notification, which invokes Act2. Using Act2, I can clear that notification. Now suppose that user doesn't clicks on the notification and invokes Act1 again, the notification doesn't gets cleared. I want that to happen. How could I do that?

Thanks, Rohit

Upvotes: 1

Views: 994

Answers (1)

user517491
user517491

Reputation:

Using android.app.NotificationManager you can clear the notification by notification id.

NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.cancel(notificationId);

Upvotes: 5

Related Questions