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
| 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.
- Value
- UserNotificationListener UserNotificationListener UserNotificationListener UserNotificationListener
A UserNotificationListener for the current user.
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.
A value that indicates whether the UserNotificationListener has access to the user's notifications.
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.
- notificationId
- unsigned int UInt32 UInt32 UInt32
The ID of the notification to retrieve.
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.
The type of notification to retrieve.
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.
- 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.
A value that specifies whether the user chose to provide access to notification.
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.