Application.EnteredBackground Event

Definition

Occurs when the app moves from the foreground to the background.

public:
 virtual event EnteredBackgroundEventHandler ^ EnteredBackground;
// Register
event_token EnteredBackground(EnteredBackgroundEventHandler const& handler) const;

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

// Revoke with event_revoker
Application::EnteredBackground_revoker EnteredBackground(auto_revoke_t, EnteredBackgroundEventHandler const& handler) const;
public event EnteredBackgroundEventHandler EnteredBackground;
function onEnteredBackground(eventArgs) { /* Your code */ }
application.addEventListener("enteredbackground", onEnteredBackground);
application.removeEventListener("enteredbackground", onEnteredBackground);
- or -
application.onenteredbackground = onEnteredBackground;
Public Custom Event EnteredBackground As EnteredBackgroundEventHandler 

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

This event is fired when the user navigates away from the app. There is a limited amount of time that an event handler for this event can run.

When your app moves into the background, the memory constraints enforced by the system may change. Use this event to check your current memory consumption and free resources in order to stay below the limit so that your app won't be suspended and possibly terminated while it is in the background. See Free memory when your app moves to the background for more details.

The EnteredBackground event runs in the apartment it was registered in.

Applies to

See also