Jaa


PushNotificationChannel.PushNotificationReceived Event

Definition

Raised when a push notification arrives on this channel.

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

Event Type

Windows requirements

App capabilities
internetClient

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.

Applies to

See also