Share via


Launchers

Version: 1.0.0

Description

The choosers and launchers APIs allow an application to integrate with common operating system tasks such as taking a picture, finding an address or a contact, making a call, or saving a ring tone. This hands-on lab walks you through the launchers available on Windows Phone.

Overview

The launchers and choosers framework enables Windows Phone applications to provide common functions such as placing phone calls, sending emails, and taking pictures for their users.

The Windows Phone application model isolates every application in its own work area for both execution (including memory isolation) and file storage. Windows Phone applications are not able to directly access common information stores such as the contacts list or to directly invoke other applications such as phoning or messaging. To support scenarios requiring common tasks such as phoning or messaging, the Windows Phone provides a set of launcher and chooser APIs that enables applications to access these useful phone features indirectly. The launcher and chooser APIs invoke distinct built-in applications that replace the currently running application. The launchers and choosers framework provides the end user with a seamless experience while masking the application switching that occurs in the background.

The framework components are as follows:

  • Launcher - A “fire and forget” action, where a specific Windows Phone functionality is launched, for example, sending an SMS message, opening a webpage, or placing a phone call

Below is the complete list of launchers that Windows Phone 7 Codenamed “Mango” supports:

Launchers

  • ConnectionSettingsTask - Enables to launch system settings application to control various connection settings
  • EmailComposeTask - Enables an application to launch the email application with a new message already displayed, so users can send email messages from within an application
  • MarketplaceDetailTask - Enables an application to launch the Windows Phone Marketplace client application and display the details page for the specified product
  • MarketplaceHubTask - Enables an application to launch the Windows Phone Marketplace client application
  • MarketplaceReviewTask - Enables an application to launch the Windows Phone Marketplace client application and display the review page for the specified product
  • MarketplaceSearchTask - Enables an application to launch the Windows Phone Marketplace client application and display the search results from the specified search parameters
  • MediaPlayerLauncher - Enables an application to launch the media player
  • PhoneCallTask - Enables an application to launch the Phone application, so users can make a phone call from within an application
  • SaveContactTask - Enables an application to launch the contacts application and provide initial data for new contact, so users can save the data from within an application to a new contact
  • SaveEmailAddressTask - Enables an application to launch the contacts application, so users can save an email address from within an application to a new or existing contact
  • SavePhoneNumberTask - Enables an application to launch the contacts application so users can save a phone number from within an application to a new or existing contact
  • SearchTask - Enables an application to launch the Web Search application
  • ShareLinkTask - Enables an application to post a link with title and message via user’s social network account
  • ShareStatusTask - Enables an application to post status update via user’s social network account
  • SmsComposeTask – Enables an application to launch the SMS application
  • WebBrowserTask - Enables an application to launch the Web Browser application

While it is always a good practice to think about application tombstoning during Window Phone development, one should consider tombstoning even more seriously when dealing with launchers and choosers.

When does an application get tombstoned?

Generally speaking, an application gets tombstoned [that is, it is placed in the back stack] when a user forward navigates away from it. While there are a few exceptions to this general rule, applications in the background may be tombstoned at any time if the system requires additional resources to carry out the current foreground activity.

An application will not be automatically tombstoned when it launches an experience that feels to the user like an extension of the original application. These experiences are native flows that help the user complete some task, like choosing a photo. Avoiding tombstoning in these cases ensures a smooth flow between the application and the experience it has called [for example, no delay between choosing a photo and returning to the application that uses it].

Below is the list of native experiences that, when invoked, do not trigger an automatic tombstone in the calling application:

  • PhotoChooserTask
  • CameraCaptureTask
  • MediaPlayerLauncher
  • EmailAddressChooserTask
  • PhoneNumberChooserTask

There are three scenarios in which an application in the background will immediately be tombstoned:

  • User forward navigates away from an application [for example, user presses the Start key]
  • Application invokes launchers or choosers not listed above
  • System requires more resources to carry out a foreground activity
Note:
 All the above information regarding tombstoning is true for Windows® Phone 7.0. On Windows® Phone 7.1 launchers and choosers never initiate tombstoning, but it may be initiated nonetheless if the device requires additional resources. For more information on the new 7.1 application execution model please refer to documentation.

Objectives

Upon completion of this lab, you will:

  • Be familiar with the launchers and choosers concept as implemented in the Windows Phone 7 application model
  • Understand how and when to use launchers and choosers
  • Have created a Silverlight application that uses the wide array of available launchers and choosers

Prerequisites

The following is required to complete this hands-on lab:

  • Microsoft Visual Studio 2010 Express for Windows Phone or Microsoft Visual Studio 2010
  • Windows Phone Codenamed “Mango” Developer Tools
    Note:
     You can download all of these tools together in a single package from https://go.microsoft.com/?linkid=9772716.

Exercises

This hands-on lab is comprised of the following exercises:

  • Introduction to the Windows Phone Launchers

Estimated time to complete this lab: 30 minutes.