Action Center is a system area, where a user can have a settings panel (composite of several system settings) and notifications list, grouped by app, and ordered chronologically inside Action Center.
These are the notifications a user has missed or ignored after swiping left to right on it.
User can access action center,
- Mobile : Swiping down from top edge of the screen.
- Desktop : Swiping left from right edge of the screen.
App can have a maximum of 20 notifications in their group. It follows the Queue format, and the last element is flushed out, once a new notification is pushed into the group.
Ideally an expiration date for a notification in the action center is 7 days, unless an earlier expiration time is specified during the creation of the toast.
Desktop
Mobile
There are various Action Center Management APIs available.
We can:
Remove one or many notifications.
Tag and group the notifications.
Replace a notification with a new one.
Set an expiration on the notifications.
Send "Ghost Toast" notifications (only show up in the notification center)
- void RemoveNotificationHistory()
- {
- ToastNotificationHistory tH = ToastNotificationManager.History;
- tH.Remove("My App toast 1");
- tH.RemoveGroup("Whatsapp");
- }
App responsibilities on notification
Apps can inform the user of 'unread' items in ways(Count on tile, listed in Action Center).
App+Action Center+Tile(s) must tell a consistent story for a good experience.
- User taps on toast popup or in Action center>App opens at the corresponding item
- User opens app and reads unread items>Notification in Action Center are removed
- User dismisses Action Center Notification>Tile badge count changes
ToastNotificationHistoryChangesTrigger-Fires, whenever a user dismisses a notification from an Action Center or when an app adds or removes or replaces a notification.
Use to trigger a Background task, in which you can maintain consistency of un-actioned item counts in app state and on tiles.
- public sealed class ActionCenterChangedTask: IBackgroundTask
- {
- public void Run(IBackgroundTaskInstance taskInstance)
- {
- var toastNotifications = ToastNotificationManager.History.GetHistory();
- if (toastNotifications != null)
- {
- var toastCount = toastNotifications.Count;
- if (toastCount == 0)
- {
- BadgeUpdateManager.CreateBadgeUpdaterForApplication().Clear();
- } else
- {
- XmlDocument xmlBadge = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);
- XmlElement badgeElement = (XmlElement) xmlBadge.SelectSingleNode("/badge");
- badgeElement.SetAttribute("value", toastCount.ToString());
- BadgeNotification badgeNotification = newBadgeNotification(xmlBadge);
- BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeNotification);
- }
- }
- }
- }