PushNotificationChannel.PushNotificationReceived 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当推送通知到达此通道时引发。
// 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);
}
注解
Windows 推送通知服务 (WNS) 仅在通知的目标应用位于前台时发送此事件。 如果应用已暂停,则不会收到事件。