Reputation: 1145
I show toast notification that it then appears on notification center.
I want then to programatically remove that notification from notification center. How can I do this? The app may be closed and restarted between time the notification is shown and when I need to remove it.
Upvotes: 4
Views: 5886
Reputation: 34286
You can programmatically remove notifications from the action center by using one of the various methods of the ToastNotificationHistory class. For example:
ToastNotificationManager.History.Remove("toast-tag");
where "toast-tag"
is the Tag of the ToastNotification that you want to remove. There are other overloads too.
If you need to remove notifications at some point in time when your app isn't running, then you'll need to do so from a background task.
Upvotes: 4