Launching, resuming, and multitasking (XAML)

[ This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation ]

Learn how to launch, suspend, and resume your app. Also learn about file associations, AutoPlay, transferring data in the background, and running your own code in the background with background tasks.

Roadmap: How does this topic relate to others? See:

Launching, suspending, and resuming apps

When users move your app off-screen, Windows 8 suspends your app in memory. This allows another app to have the foreground. When an app is suspended, it is resident in memory, and Windows has stopped it from running.

When users bring your app back to the foreground, they expect the app to resume where they left off. As long as your app stays suspended, Windows automatically preserves your app's data in memory and restores it when your app resumes. Apps are also terminated occasionally, so your app should use suspending events to save its current state.

Note   If you need to do asynchronous work when your app is being suspended you will need to defer completion of suspend until after your work completes. You can use the GetDeferral method on the SuspendingOperation object (available via the event args) to delay completion of suspend until after you call the Complete method on the returned SuspendingDeferral object.

 

File and URI associations

You can launch the user's default app for a file type or URI. You can also enable your app to be the default app for a file type or URI scheme name.

AutoPlay

When users connect a device to their computer, you can ensure your app is available for them to choose.

Background file transfer

Windows helps your app manage file transfers to and from locations on the web, even if the user switches to a different app.

Background tasks

You can use background tasks to run lightweight code in the background. Any app can register a background task in response to certain system events. Background tasks can't run code that directly updates the UI; instead, they show information to the user with tile updates, badge updates, and toast notifications. Some apps, like mail, VOIP, and IM, allow the user to communicate in real-time. If the user allows, your app can show a badge or tile on the lock screen. When your app is on the lock screen, it gains access to real-time background tasks.

For detailed guidance on background tasks see Supporting your app with background tasks.

Multitasking with notifications and background audio

You can also keep providing functionality from the background with notifications and background audio. See the following topics outside of this section.

Kid's Corner

Kid’s Corner is a Windows Phone feature that allows the user to put their phone in a special mode for kids, in which only the apps and media they specify can be accessed. An app can detect at run time if it is running in Kid’s Corner mode and modify its behavior and UI to be appropriate for a child user. See Detecting when your app is running in Kid's Corner mode.

Application lifecycle

Lock screen overview

Guidelines and checklist for lock screen tiles