PushNotificationChannelManager.ChannelsRevoked 이벤트

정의

새 채널을 즉시 요청할 수 있도록 푸시 채널이 해지될 때 발생합니다. 이렇게 하면 해지된 WNS 채널을 사용하여 발생하는 가동 중지 시간이 최소화됩니다. 이벤트 인수 형식은 PushNotificationChannelsRevokedEventArgs입니다.

// Register
static event_token ChannelsRevoked(EventHandler<PushNotificationChannelsRevokedEventArgs> const& handler) const;

// Revoke with event_token
static void ChannelsRevoked(event_token const* cookie) const;

// Revoke with event_revoker
static PushNotificationChannelManager::ChannelsRevoked_revoker ChannelsRevoked(auto_revoke_t, EventHandler<PushNotificationChannelsRevokedEventArgs> const& handler) const;
public static event System.EventHandler<PushNotificationChannelsRevokedEventArgs> ChannelsRevoked;
function onChannelsRevoked(eventArgs) { /* Your code */ }
Windows.Networking.PushNotifications.PushNotificationChannelManager.addEventListener("channelsrevoked", onChannelsRevoked);
Windows.Networking.PushNotifications.PushNotificationChannelManager.removeEventListener("channelsrevoked", onChannelsRevoked);
- or -
Windows.Networking.PushNotifications.PushNotificationChannelManager.onchannelsrevoked = onChannelsRevoked;
Public Shared Custom Event ChannelsRevoked As EventHandler(Of PushNotificationChannelsRevokedEventArgs) 

이벤트 유형

Windows 요구 사항

디바이스 패밀리
Windows 10, version 2004 (10.0.19041.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v10.0에서 도입되었습니다.)

예제

// Create the manager, and subscribe to the ChannelsRevoked event.

PushNotificationChannel channel = null;
PushNotificationChannelManager.ChannelsRevoked += OnChannelsRevoked;

try
{
    // Create the channel manager for the user.
    PushNotificationChannelManagerForUser channelManagerForUser = PushNotificationChannelManager.GetDefault();

    // Create the channel.
    channel = await channelManagerForUser.CreatePushNotificationChannelForApplicationAsync();

    // If the channel isn't null, send to app service.
    if (channel != null)
    {
        sendChannelURIToServer(channel.Uri);
    }
}
catch (Exception e){ ... }

...

private async void OnChannelsRevoked(PushNotificationChannelsRevokedEventArgs e)
{
    // PushNotificationChannelsRevokedEventArgs has no members.
    // Previous channel was revoked, time to create a new channel as shown above.
    ...
}    

설명

WNS를 통해 서비스에서 푸시 알림을 수신하는 푸시 채널을 만듭니다. 이러한 채널은 영구적이지 않으며 다양한 이유로 변경될 수 있습니다(가장 일반적인 채널은 30일 후에 만료됨). 채널을 해지하는 플랫폼 내에서 발생할 수 있는 이벤트도 있습니다(예: 전역 디바이스 ID 변경). 그러나 이 이벤트를 사용하는 경우 앱이 시작될 때마다 새 채널을 요청할 필요가 없습니다.

적용 대상