UserNotificationListener UserNotificationListener UserNotificationListener UserNotificationListener Class

Definition

Reads and manages a user's notifications.

public : sealed class UserNotificationListener : IUserNotificationListenerpublic sealed class UserNotificationListener : IUserNotificationListenerPublic NotInheritable Class UserNotificationListener Implements IUserNotificationListener// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Remarks

UserNotificationListener requires explicit user permission to be granted before it may be used, so before attempting to access notifications be sure you call RequestAccessAsync from a UI-thread.

Properties

Current Current Current Current

Gets a UserNotificationListener for the current user.

public : static UserNotificationListener Current { get; }public static UserNotificationListener Current { get; }Public Static ReadOnly Property Current As UserNotificationListener// You can use this property in JavaScript.

Methods

ClearNotifications() ClearNotifications() ClearNotifications() ClearNotifications()

Clears the notification.

public : void ClearNotifications()public void ClearNotifications()Public Function ClearNotifications() As void// You can use this method in JavaScript.

GetAccessStatus() GetAccessStatus() GetAccessStatus() GetAccessStatus()

Gets a value that indicates whether the UserNotificationListener has access to the user's notifications.

public : UserNotificationListenerAccessStatus GetAccessStatus()public UserNotificationListenerAccessStatus GetAccessStatus()Public Function GetAccessStatus() As UserNotificationListenerAccessStatus// You can use this method in JavaScript.
Returns

GetNotification(UInt32) GetNotification(UInt32) GetNotification(UInt32) GetNotification(UInt32)

Retrieves the specified notification.

public : UserNotification GetNotification(unsigned int notificationId)public UserNotification GetNotification(UInt32 notificationId)Public Function GetNotification(notificationId As UInt32) As UserNotification// You can use this method in JavaScript.
Parameters
notificationId
unsigned int UInt32 UInt32 UInt32

The ID of the notification to retrieve.

Returns

The notification if it exists; otherwise, null.

GetNotificationsAsync(NotificationKinds) GetNotificationsAsync(NotificationKinds) GetNotificationsAsync(NotificationKinds) GetNotificationsAsync(NotificationKinds)

Asynchronously retrieves notifications that match the specified notification kind.

public : IAsyncOperation<IVectorView<UserNotification>> GetNotificationsAsync(NotificationKinds kinds)public IAsyncOperation<IReadOnlyList<UserNotification>> GetNotificationsAsync(NotificationKinds kinds)Public Function GetNotificationsAsync(kinds As NotificationKinds) As IAsyncOperation( Of IReadOnlyListUserNotification )// You can use this method in JavaScript.
Parameters
kinds
NotificationKinds NotificationKinds NotificationKinds NotificationKinds

The type of notification to retrieve.

Returns
IAsyncOperation<IVectorView<UserNotification>> IAsyncOperation<IReadOnlyList<UserNotification>> IAsyncOperation<IReadOnlyList<UserNotification>> IAsyncOperation<IReadOnlyList<UserNotification>>

A collection of notifications of the specified type.

RemoveNotification(UInt32) RemoveNotification(UInt32) RemoveNotification(UInt32) RemoveNotification(UInt32)

Removes the specified notification.

public : void RemoveNotification(unsigned int notificationId)public void RemoveNotification(UInt32 notificationId)Public Function RemoveNotification(notificationId As UInt32) As void// You can use this method in JavaScript.
Parameters
notificationId
unsigned int UInt32 UInt32 UInt32

The ID of the notification to remove.

RequestAccessAsync() RequestAccessAsync() RequestAccessAsync() RequestAccessAsync()

Requests the user's permission to manage notifications.

public : IAsyncOperation<UserNotificationListenerAccessStatus> RequestAccessAsync()public IAsyncOperation<UserNotificationListenerAccessStatus> RequestAccessAsync()Public Function RequestAccessAsync() As IAsyncOperation( Of UserNotificationListenerAccessStatus )// You can use this method in JavaScript.
Returns

Events

NotificationChanged NotificationChanged NotificationChanged NotificationChanged

Occurs when a notification is added or removed.

public : event TypedEventHandler NotificationChanged<UserNotificationListener,  UserNotificationChangedEventArgs>public event TypedEventHandler NotificationChanged<UserNotificationListener,  UserNotificationChangedEventArgs>Public Event NotificationChanged<UserNotificationListener,  UserNotificationChangedEventArgs>// You can use this event in JavaScript.