PushNotificationReceivedEventArgs Класс

Определение

Инкапсулирует push-уведомление, полученное с сервера приложений, определяющее тип и предоставляющее содержимое уведомления. Windows передает эти сведения в событие 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
Наследование
Object Platform::Object IInspectable PushNotificationReceivedEventArgs
Атрибуты

Требования к Windows

Семейство устройств
Windows 10 (появилось в 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (появилось в v1.0)
Возможности приложения
internetClient

Примеры

В следующем примере показаны используемые члены этого класса.

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

Комментарии

Приложение получает этот класс при обработке события PushNotificationReceived .

Свойства

BadgeNotification

Возвращает содержимое обновления индикатора событий, выполняемого в ответ на это push-уведомление.

Cancel

Возвращает или задает значение, указывающее, должна ли Windows выполнять обработку уведомления по умолчанию.

NotificationType

Возвращает тип push-уведомления, полученного от сервера приложений.

RawNotification

Возвращает содержимое, определенное приложением, содержащееся в этом push-уведомлении, содержимое которого используется для выполнения фоновой задачи в приложении.

TileNotification

Возвращает содержимое обновления плитки, выполняемого в ответ на это push-уведомление.

ToastNotification

Возвращает содержимое всплывающего уведомления, отображаемого в ответ на это push-уведомление.

Применяется к

См. также раздел