CoreApplication.BackgroundActivated Event

Definition

Fired when your app is activated by a background trigger.

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

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

// Revoke with event_revoker
static CoreApplication::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

Windows 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