Share via


PushNotificationReceivedEventArgs 클래스

정의

앱 서버에서 받은 푸시 알림을 캡슐화하여 유형을 식별하고 알림 콘텐츠를 제공합니다. 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

이 푸시 알림에 대한 응답으로 수행할 배지 업데이트의 콘텐츠를 가져옵니다.

Cancel

Windows에서 알림의 기본 처리를 수행해야 하는지 여부를 가져오거나 설정합니다.

NotificationType

앱 서버에서 받은 푸시 알림 유형을 가져옵니다.

RawNotification

이 푸시 알림에 포함된 앱 정의 콘텐츠를 가져오며, 콘텐츠는 앱에서 백그라운드 작업을 수행하는 데 사용됩니다.

TileNotification

이 푸시 알림에 대한 응답으로 수행할 타일 업데이트의 콘텐츠를 가져옵니다.

ToastNotification

이 푸시 알림에 대한 응답으로 표시할 알림의 콘텐츠를 가져옵니다.

적용 대상

추가 정보