Launchers and Choosers for Windows Phone 8

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

You can use Launchers and Choosers in your Windows Phone applications to enable users to perform common tasks. By using Launchers and Choosers, you help provide a consistent user experience throughout the Windows Phone platform. At the same time, by using Launchers and Choosers, you can distinguish your applications by providing additional functionality.

The Launcher and Chooser APIs invoke distinct built-in applications that replace the currently running application. When implemented correctly, the Launchers and Choosers framework can provide the end user with a seamless experience in which it is not apparent that the user is switching between applications.

This topic contains the following sections.

Launchers

A Launcher is an API that launches one of the built-in applications, such as the Contacts application or the web browser, through which the user completes a task. When the new application appears, the user can choose to complete or cancel the task. When the user closes the new application, the calling application is usually reactivated. Examples of Launcher tasks include composing an email, sharing a link on a social network, and opening the browser to a specific website.

Note

Launchers do not return data or status to your application.

The following are the general steps for using a Launcher:

  1. Create an instance of the task type for the Launcher.

  2. Set any required and optional properties of the task object. These determine the behavior of the task application when it is invoked.

  3. Call the Show method of the task object.

For the full list of available Launchers, and code for using them, see Launchers for Windows Phone 8.

Choosers

A Chooser is an API that launches one of the built-in applications, such as the Contacts application or the camera, through which the user completes a task. When the new application appears, the user can choose to complete or cancel the task. When the user closes the new application, the calling application is usually reactivated and supplied with data and status. Examples of Chooser tasks include selecting a contact’s email address, selecting a photo from the phone, and saving a new ringtone.

Note

Choosers can return data and status to your application. However, if the user presses Start while the new application is open, the calling application may never be reactivated.

The following are the general steps for using a Chooser:

  1. Create an instance of the task type for the Chooser.

  2. Identify the callback method to run after the user completes the task.

  3. Set any required and optional properties of the task object.

  4. Call the Show method of the task object.

  5. Implement the completed event handler to capture data and status after the user completes the task.

For the full list of available Choosers, and code for using them, see Choosers for Windows Phone 8.

Launchers, Choosers, and the Windows Phone Execution Model

An important concept for Windows Phone application developers to consider in general, and especially when using Launchers and Choosers, is that the calling application is either put into a dormant state or tombstoned when another application is launched.

When the new task application is launched, your application is deactivated and is no longer running. Usually, your application is put into a dormant state by the operating system. After completing the task, the user can return to your application that was preserved in memory, and it resumes in the same state as before the new application was launched. However, it is also possible that your application may be terminated by the operating system. In this case, if the user returns to your application, it is a new instance, and the state of your application is not automatically restored.