Launching, resuming, and background tasks
[ Updated for UWP apps on Windows 10. For Windows 8.x articles, see the archive ]
This section describes the following:
- What happens when a Universal Windows Platform (UWP) app is started, suspended, resumed, and terminated.
- How to activate apps by using a contract or extension.
- How to use background tasks which allow a UWP app to do work even when the app is not in the foreground.
- App services, which allow your Universal Windows Platform (UWP) app to provide services that can be consumed from other UWP apps so that you can build apps that build off of each other.
- How to discover connected devices, launch an app on another device, and communicate with an app on a remote device so that you can create user experiences that flow across devices.
- How to add a splash screen to your app.
The app lifecycle
|App lifecycle||Learn about the life cycle of a UWP app and what happens when Windows launches, suspends, and resumes your app.|
|Handle app prelaunch||Learn how to handle app prelaunch.|
|Handle app activation||Learn how to handle app activation.|
|Handle app suspend||Learn how to save important application data when the system suspends your app.|
|Handle app resume||Learn how to refresh displayed content when the system resumes your app.|
|Free memory when your app moves to the background||Learn how to reduce the amount of memory that your app uses when it is in the background state so that it won't be terminated.|
|URI and File activation||Description|
|Connected apps and devices (Project "Rome")||Learn how to discover connected devices, launch an app on another device, and communicate with an app on a remote device.|
|Launch an app for results||Learn how to launch an app from another app and exchange data between the two.|
|Launch the default app for a URI||Learn how to launch the default app for a Uniform Resource Identifier (URI).|
|Launch an app on a remote device||Learn how to launch an app for a URI on a remote device.|
|Handle URI activation||Learn how to register an app to become the default handler for a URI scheme name.|
|Support web-to-app linking with app Uri handlers||Learn how to register an app to be the default handler for a http or https link.|
|Launch the default app for a file||Learn how to launch the default app for a file type.|
|Handle file activation||Learn how to register your app to be the default handler for a file type.|
|Reserved file and URI scheme names||This topic lists the reserved file and URI scheme names that are not available to your app.|
|Auto-launching with AutoPlay||Learn how to use AutoPlay to provide your app as an option when a user connects a device to their PC.|
|Launch the Windows Settings app||Learn how to launch the Windows Settings app.|
|Launch the Windows Store app||Learn how to launch the Windows Store app.|
|Launch the Windows Maps app||Learn how to launch the Windows Maps app.|
|Launch the Windows People app||Learn how to launch the Windows People app.|
|Support your app with background tasks||The topics in this section show how to run your own lightweight code in the background by responding to triggers with background tasks.|
|Access sensors and devices from a background task||DeviceUseTrigger lets your Universal Windows app access sensors and peripheral devices in the background, even when your foreground app is suspended.|
|Guidelines for background tasks||Ensure your app meets the requirements for running background tasks.|
|Create and register a background task that runs in a separate process||Create a background task class and register it to run in a separate process when your app is not in the foreground.|
|Create and register a background task that runs in a single process||Create a background task class that runs in the same process as your foreground app.|
|Convert a multi-process background task to a single-process background task||Learn how to convert your background task that was designed to run in a separate process when your app was in the background, into a single-process background task that runs in the same process as your foreground app.|
|Debug a background task||Learn how to debug a background task, including background task activation and debug tracing in the Windows event log.|
|Declare background tasks in the application manifest||Enable the use of background tasks by declaring them as extensions in the app manifest.|
|Handle a cancelled background task||Learn how to make a background task that recognizes cancellation requests and stops work, reporting the cancellation to the app using persistent storage.|
|Monitor background task progress and completion||Learn how your app can recognize background task progress and completion.|
|Register a background task||Learn how to create a function that can be re-used to safely register most background tasks.|
|Respond to system events with background tasks||Learn how to create a background task that responds to SystemTrigger events.|
|Run a background task on a timer||Learn how to schedule a one-time background task, or run a periodic background task.|
|Set conditions for running a background task||Learn how to set conditions that control when your background task will run.|
|Transfer data in the background||Use the background transfer API to copy files in the background.|
|Update a live tile from a background task||Use a background task to update your app's live tile with fresh content.|
|Use a maintenance trigger||Learn how to use the MaintenanceTrigger class to run lightweight code in the background while the device is plugged in.|
|Create and consume an app service||Learn how to write a UWP app that can provide services to other UWP apps, and how to consume those services.|
|Communicate with a remote app service||Learn how to exchange messages with an app service running on a remote device.|
|Convert an app service to run in the same process as its host app||Learn how to Convert app service code that runs in a separate background process into code that runs inside the same process as your app service host app.|
Add a splash screen
All UWP apps must have a splash screen, which is a composite of a splash screen image and a background color, both of which can be customized.
Your splash screen is displayed immediately when the user launches your app. This provides immediate feedback to users while app resources are initialized. As soon as your app is ready for interaction, the splash screen is dismissed.
A well-designed splash screen can make your app more inviting. Here's a simple, understated splash screen:
This splash screen is created by combining a green background color with a transparent PNG.
Putting an image and background color together to form the splash screen helps the splash screen look good, regardless of the device your app is installed on. When the splash screen is displayed, only the size of the background changes to compensate for a variety of screen sizes. Your image always remains intact.
Additionally, you can use the SplashScreen class to customize your app's launch experience. You can position an extended splash screen, which you create, to give your app more time to complete additional tasks like preparing app UI or completing networking operations. You can also use the SplashScreen class to notify you when the splash screen is dismissed, so that you can begin entrance animations.
|Add a splash screen||Set your app's splash screen image and background color.|
|Display a splash screen for more time||Display a splash screen for more time by creating an extended splash screen for your app. This extended screen imitates the splash screen shown when your app is launched, and can be customized.|