PushNotificationReceivedEventArgs PushNotificationReceivedEventArgs PushNotificationReceivedEventArgs PushNotificationReceivedEventArgs PushNotificationReceivedEventArgs 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 : IPushNotificationReceivedEventArgs
struct winrt::Windows::Networking::PushNotifications::PushNotificationReceivedEventArgs : IPushNotificationReceivedEventArgs
public sealed class PushNotificationReceivedEventArgs : IPushNotificationReceivedEventArgs
Public NotInheritable Class PushNotificationReceivedEventArgs Implements IPushNotificationReceivedEventArgs
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
internetClient

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;
}

Remarks

Your app receives this class when processing the PushNotificationReceived event.

Properties

BadgeNotification BadgeNotification BadgeNotification BadgeNotification BadgeNotification

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

Cancel Cancel Cancel Cancel Cancel

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

NotificationType NotificationType NotificationType NotificationType NotificationType

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

RawNotification RawNotification 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.

TileNotification TileNotification TileNotification TileNotification TileNotification

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

ToastNotification ToastNotification ToastNotification ToastNotification ToastNotification

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

See Also