Share via


PushNotificationChannel.PushNotificationReceived Evento

Definición

Se genera cuando llega una notificación push a este canal.

// 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) 

Tipo de evento

Requisitos de Windows

Características de aplicaciones
internetClient

Ejemplos

En el ejemplo siguiente se muestra un agente de escucha para este evento, que invoca al controlador de eventos.

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

Comentarios

Windows Push Notification Services (WNS) envía este evento solo cuando la aplicación de destino de la notificación está en primer plano. Si la aplicación está suspendida, no recibe el evento .

Se aplica a

Consulte también