PushNotificationManager.PushReceived 事件
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当平台收到应用的推送通知时引发。
注意
PushNotificationManager 类依赖于 Singleton 包。 由于这种依赖关系,如果要从 自包含应用调用这些 API,请注意一些注意事项。 有关详细信息和细节,请参阅 附加 MSIX 包的依赖项。
// Register
event_token PushReceived(TypedEventHandler<PushNotificationManager, PushNotificationReceivedEventArgs const&> const& handler) const;
// Revoke with event_token
void PushReceived(event_token const* cookie) const;
// Revoke with event_revoker
PushNotificationManager::PushReceived_revoker PushReceived(auto_revoke_t, TypedEventHandler<PushNotificationManager, PushNotificationReceivedEventArgs const&> const& handler) const;
public event TypedEventHandler<PushNotificationManager,PushNotificationReceivedEventArgs> PushReceived;
function onPushReceived(eventArgs) { /* Your code */ }
pushNotificationManager.addEventListener("pushreceived", onPushReceived);
pushNotificationManager.removeEventListener("pushreceived", onPushReceived);
- or -
pushNotificationManager.onpushreceived = onPushReceived;
Public Custom Event PushReceived As TypedEventHandler(Of PushNotificationManager, PushNotificationReceivedEventArgs)
事件类型
注解
若要确保在正在运行的应用过程中调用 PushReceived 事件处理程序,请确保在调用 Register之前注册此事件的处理程序。 否则,将启动一个新进程来处理通知。