PushNotificationReceivedEventArgs Classe

Définition

Encapsule une notification Push qui a été reçue du serveur d’applications, en identifiant le type et en fournissant le contenu de la notification. Windows transmet ces informations dans l’événement PushNotificationReceived .

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
Héritage
Object Platform::Object IInspectable PushNotificationReceivedEventArgs
Attributs

Configuration requise pour Windows

Famille d’appareils
Windows 10 (introduit dans 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduit dans v1.0)
Fonctionnalités de l’application
internetClient

Exemples

L’exemple suivant montre les membres de cette classe en cours d’utilisation.

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

Remarques

Votre application reçoit cette classe lors du traitement de l’événement PushNotificationReceived .

Propriétés

BadgeNotification

Obtient le contenu d’une mise à jour de badge à effectuer en réponse à cette notification Push.

Cancel

Obtient ou définit si Windows doit effectuer sa gestion par défaut de la notification.

NotificationType

Obtient le type de notification Push qui a été reçue du serveur d’applications.

RawNotification

Obtient le contenu défini par l’application contenu dans cette notification Push, dont le contenu est utilisé pour effectuer une tâche en arrière-plan sur l’application.

TileNotification

Obtient le contenu d’une mise à jour de vignette à effectuer en réponse à cette notification Push.

ToastNotification

Obtient le contenu d’un toast à afficher en réponse à cette notification Push.

S’applique à

Voir aussi