Push​Notification​Received​Event​Args Push​Notification​Received​Event​Args Push​Notification​Received​Event​Args Class

Definition

Encapsulates a push notification that has been received from the app server, identifying the type and supplying the content of the notification. Windows passes this information in the PushNotificationReceived event.

public sealed class PushNotificationReceivedEventArgs : IPushNotificationReceivedEventArgspublic sealed class PushNotificationReceivedEventArgs : IPushNotificationReceivedEventArgsPublic NotInheritable Class PushNotificationReceivedEventArgs Implements IPushNotificationReceivedEventArgs
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
internetClient

Remarks

Your app receives this class when processing the PushNotificationReceived event.

Examples

The following example shows the members of this class in use.


function listeningForPushNotification() {
    if (channel) {
        channel.addEventListener("pushnotificationreceived", pushNotificationReceivedHandler);
}

function pushNotificationReceivedHandler(e) {
    var notificationTypeName = "";
    var notificationPayload;
    switch (e.notificationType) {
        // You can get the toast, tile, or badge notification object.
        // In this example, we take the XML from the notification.
        case pushNotifications.PushNotificationType.toast:
            notificationTypeName = "Toast";
            notificationPayload = e.toastNotification.content.getXml();
            break;
        case pushNotifications.PushNotificationType.tile:
            notificationTypeName = "Tile";
            notificationPayload = e.tileNotification.content.getXml();
            break;
        case pushNotifications.PushNotificationType.badge:
            notificationTypeName = "Badge";
            notificationPayload = e.badgeNotification.content.getXml();
            break;
    }
    e.cancel = true;
}

Properties

BadgeNotification BadgeNotification BadgeNotification

Gets the content of a badge update to perform in response to this push notification.

public BadgeNotification BadgeNotification { get; }public BadgeNotification BadgeNotification { get; }Public ReadOnly Property BadgeNotification As BadgeNotification
Value
BadgeNotification BadgeNotification BadgeNotification

Holds the update information. If NotificationType is not of type Badge, this value is NULL.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
internetClient
See Also

Cancel Cancel Cancel

Gets or sets whether Windows should perform its default handling of the notification.

public PlatForm::Boolean Cancel { get; set; }public bool Cancel { get; set; }Public ReadWrite Property Cancel As bool
Value
bool bool bool

True to prevent default processing of the notification by Windows, otherwise false. The default value is false.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
internetClient
See Also

NotificationType NotificationType NotificationType

Gets the type of push notification that has been received from the app server.

public PushNotificationType NotificationType { get; }public PushNotificationType NotificationType { get; }Public ReadOnly Property NotificationType As PushNotificationType
Value
PushNotificationType PushNotificationType PushNotificationType

The type (badge, tile, toast, or raw) of push notification that has been received.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
internetClient

Remarks

Channels bound to secondary tiles will only accept push notifications for Tile and Badge updates. Toast and Raw notifications must use a channel bound to an application.

See Also

RawNotification RawNotification RawNotification

Gets the app-defined content contained in this push notification, the contents of which are used to perform a background task on the app.

public RawNotification RawNotification { get; }public RawNotification RawNotification { get; }Public ReadOnly Property RawNotification As RawNotification
Value
RawNotification RawNotification RawNotification

Encapsulates the app-defined content of the raw notification. If NotificationType is not of type Raw, this value is NULL.

Attributes
See Also

TileNotification TileNotification TileNotification

Gets the content of a tile update to perform in response to this push notification.

public TileNotification TileNotification { get; }public TileNotification TileNotification { get; }Public ReadOnly Property TileNotification As TileNotification
Value
TileNotification TileNotification TileNotification

Holds the update information. If NotificationType is not of type Tile, this value is NULL.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
internetClient
See Also

ToastNotification ToastNotification ToastNotification

Gets the content of a toast to display in response to this push notification.

public ToastNotification ToastNotification { get; }public ToastNotification ToastNotification { get; }Public ReadOnly Property ToastNotification As ToastNotification
Value
ToastNotification ToastNotification ToastNotification

Holds the toast information. If NotificationType is not of type Toast, this value is NULL.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
internetClient
See Also

See Also