Share via


PushNotificationReceivedEventArgs Klasse

Definition

Kapselt eine Pushbenachrichtigung, die vom App-Server empfangen wurde, wobei der Typ identifiziert und der Inhalt der Benachrichtigung bereitgestellt wird. Windows übergibt diese Informationen im PushNotificationReceived-Ereignis .

public ref class PushNotificationReceivedEventArgs sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
class PushNotificationReceivedEventArgs final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class PushNotificationReceivedEventArgs final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public sealed class PushNotificationReceivedEventArgs
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class PushNotificationReceivedEventArgs
Public NotInheritable Class PushNotificationReceivedEventArgs
Vererbung
Object Platform::Object IInspectable PushNotificationReceivedEventArgs
Attribute

Windows-Anforderungen

Gerätefamilie
Windows 10 (eingeführt in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (eingeführt in v1.0)
App-Funktionen
internetClient

Beispiele

Das folgende Beispiel zeigt die verwendeten Member dieser Klasse.

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

Hinweise

Ihre App empfängt diese Klasse beim Verarbeiten des PushNotificationReceived-Ereignisses .

Eigenschaften

BadgeNotification

Ruft den Inhalt eines Badgeupdates ab, das als Reaktion auf diese Pushbenachrichtigung ausgeführt werden soll.

Cancel

Ruft ab oder legt fest, ob Windows die Standardbehandlung der Benachrichtigung ausführen soll.

NotificationType

Ruft den Typ der Pushbenachrichtigung ab, die vom App-Server empfangen wurde.

RawNotification

Ruft den app-definierten Inhalt ab, der in dieser Pushbenachrichtigung enthalten ist, deren Inhalt zum Ausführen einer Hintergrundaufgabe für die App verwendet wird.

TileNotification

Ruft den Inhalt eines Kachelupdates ab, das als Reaktion auf diese Pushbenachrichtigung ausgeführt werden soll.

ToastNotification

Ruft den Inhalt eines Popups ab, das als Reaktion auf diese Pushbenachrichtigung angezeigt werden soll.

Gilt für:

Weitere Informationen