CoreApplication.BackgroundActivated Event

Definition

Fired when your app is activated by a background trigger.

// Register
event_token BackgroundActivated(EventHandler<BackgroundActivatedEventArgs> const& handler) const;

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

// Revoke with event_revoker
BackgroundActivated_revoker BackgroundActivated(auto_revoke_t, EventHandler<BackgroundActivatedEventArgs> const& handler) const;
public static event System.EventHandler<BackgroundActivatedEventArgs> BackgroundActivated;
function onBackgroundActivated(eventArgs) { /* Your code */ }
Windows.ApplicationModel.Core.CoreApplication.addEventListener("backgroundactivated", onBackgroundActivated);
Windows.ApplicationModel.Core.CoreApplication.removeEventListener("backgroundactivated", onBackgroundActivated);
- or -
Windows.ApplicationModel.Core.CoreApplication.onbackgroundactivated = onBackgroundActivated;
Public Shared Custom Event BackgroundActivated As EventHandler(Of BackgroundActivatedEventArgs) 

Event Type

EventHandler<BackgroundActivatedEventArgs>

Windows 10 requirements

Device family
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v3.0)

Remarks

Register your background triggers with BackgroundTaskBuilder, but do not set the TaskEntryPoint. This will enable this event to fire when your trigger is signaled. The event handler has a BackgroundActivatedEventArgs parameter which contains everything that the IBackgroundTask.Run method delivers.

Tip

By the time an app enters the background state, none of its UI is visible.

Applies to

See also