PushNotificationChannel.PushNotificationReceived PushNotificationChannel.PushNotificationReceived PushNotificationChannel.PushNotificationReceived PushNotificationChannel.PushNotificationReceived PushNotificationChannel.PushNotificationReceived Event

Definition

Raised when a push notification arrives on this channel.

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

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

// Revoke with event_revoker
PushNotificationReceived_revoker PushNotificationReceived(auto_revoke_t, TypedEventHandler<PushNotificationChannel, PushNotificationReceivedEventArgs> const& handler) const;
public event TypedEventHandler<PushNotificationChannel, PushNotificationReceivedEventArgs> PushNotificationReceived
Public Event PushNotificationReceived As TypedEventHandler (Of PushNotificationChannel, PushNotificationReceivedEventArgs)
function onPushNotificationReceived(eventArgs){/* Your code */}


pushNotificationChannel.addEventListener("pushnotificationreceived", onPushNotificationReceived);
pushNotificationChannel.removeEventListener("pushnotificationreceived", onPushNotificationReceived);

Examples

The following example shows a listener for this event, which invokes the event handler.


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

Remarks

Windows Push Notification Services (WNS) sends this event only when the notification's target app is in the foreground. If the app is suspended, it does not receive the event.

See also