Share via

How to resume an app (HTML)

Learn how to refresh content when the system resumes your Windows Runtime app.

The system suspends your app whenever the user switches to another app or to the desktop. The system resumes your app whenever the user switches back to it. When the system resumes your app, the content of your variables and data structures is the same as it was before the system suspended the app. The system restores your app exactly where it left off, so that it appears to the user as if it's been running in the background. However, your app may have been suspended for a significant amount of time, so it should refresh any displayed content that might have changed while it was suspended, such as news feeds or the user's location.

The following steps will show you how to register for the resuming event and use it to refresh stale content after a suspend.


Step 1: Register for the resuming event

Register for the resuming event, which indicates that the app has resumed after being suspended.

Windows.UI.WebUI.WebUIApplication.addEventListener("resuming", resumingHandler, false);

Step 2: Refresh displayed content after suspension

When your app receives the resuming event, it has the opportunity to refresh any content that may have become stale while the app was suspended.

function resumingHandler() {
    // TODO: Refresh network data


If your app doesn't have any content that could become stale and may need refreshing, there's no need for it to handle the resuming event.

A note about debugging using Visual Studio: When your app is attached to the Visual Studio debugger, you can send it a resume event. Make sure the Debug Location toolbar is being shown, and click the drop-down next to the Suspend icon. Then choose Resume.


For Windows Phone Store apps, the resuming event is always followed by the activated event, even when your app is currently suspended and the user re-launches your app from a primary tile or app list. Apps can skip initialization if there is already content set on the current window. You can check the LaunchActivatedEventArgs.TileId property to determine if the app was launched from a primary or a secondary tile and, based on that information, decide whether you should present a fresh or resume app experience.

Complete example

See the App activate and suspend using WinJS sample and the App activate, resume, and suspend using the WinRT sample for complete code examples showing how to handle app lifecycle events.


How to activate an app

How to suspend an app


Application lifecycle


Guidelines for app suspend and resume