AppBroadcastBackgroundService.HeartbeatRequested 事件

定义

由系统定期引发,以确认广播后台任务当前处于活动状态。

// Register
event_token HeartbeatRequested(TypedEventHandler<AppBroadcastBackgroundService, AppBroadcastHeartbeatRequestedEventArgs const&> const& handler) const;

// Revoke with event_token
void HeartbeatRequested(event_token const* cookie) const;

// Revoke with event_revoker
AppBroadcastBackgroundService::HeartbeatRequested_revoker HeartbeatRequested(auto_revoke_t, TypedEventHandler<AppBroadcastBackgroundService, AppBroadcastHeartbeatRequestedEventArgs const&> const& handler) const;
public event TypedEventHandler<AppBroadcastBackgroundService,AppBroadcastHeartbeatRequestedEventArgs> HeartbeatRequested;
function onHeartbeatRequested(eventArgs) { /* Your code */ }
appBroadcastBackgroundService.addEventListener("heartbeatrequested", onHeartbeatRequested);
appBroadcastBackgroundService.removeEventListener("heartbeatrequested", onHeartbeatRequested);
- or -
appBroadcastBackgroundService.onheartbeatrequested = onHeartbeatRequested;
Public Custom Event HeartbeatRequested As TypedEventHandler(Of AppBroadcastBackgroundService, AppBroadcastHeartbeatRequestedEventArgs) 

事件类型

Windows 要求

应用功能
appBroadcast appBroadcastSettings

注解

Handled 属性设置为 true 以确认后台任务当前处于活动状态。 未能响应此事件并将 Handled 属性设置为 true 可能会导致广播应用的后台任务被终止。

适用于