PushNotificationChannel.PushNotificationReceived Событие

Определение

Возникает при поступлении push-уведомления в этот канал.

// Register
event_token PushNotificationReceived(TypedEventHandler<PushNotificationChannel, PushNotificationReceivedEventArgs const&> const& handler) const;

// Revoke with event_token
void PushNotificationReceived(event_token const* cookie) const;

// Revoke with event_revoker
PushNotificationChannel::PushNotificationReceived_revoker PushNotificationReceived(auto_revoke_t, TypedEventHandler<PushNotificationChannel, PushNotificationReceivedEventArgs const&> const& handler) const;
public event TypedEventHandler<PushNotificationChannel,PushNotificationReceivedEventArgs> PushNotificationReceived;
function onPushNotificationReceived(eventArgs) { /* Your code */ }
pushNotificationChannel.addEventListener("pushnotificationreceived", onPushNotificationReceived);
pushNotificationChannel.removeEventListener("pushnotificationreceived", onPushNotificationReceived);
- or -
pushNotificationChannel.onpushnotificationreceived = onPushNotificationReceived;
Public Custom Event PushNotificationReceived As TypedEventHandler(Of PushNotificationChannel, PushNotificationReceivedEventArgs) 

Тип события

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

Возможности приложения
internetClient

Примеры

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

function listeningForPushNotification() {
    if (channel) {
        channel.addEventListener("pushnotificationreceived", pushNotificationReceivedHandler);
}

Комментарии

Службы push-уведомлений Windows (WNS) отправляют это событие только в том случае, если целевое приложение уведомления находится на переднем плане. Если приложение приостановлено, оно не получает событие.

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

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