Launchers are a set of APIs that Windows Phone applications can use to enable common tasks such as making a phone call or sending an email. Unlike Choosers, Launchers do not return a value back to the calling application.
Using Launchers in Your Application.
The Launcher APIs are belong to the Microsoft.Phone.Tasks namespace. You need to add a using directive for this namespace to the PhoneApplicationPage
class file. All of the Launcher APIs function in a similar manner. First, you create an instance of the Launcher class you wish to use. Next, you set properties of the Launcher object that will determine the behavior of the task application when it is invoked. For example, you can specify a phone number that will be displayed when the Phone application launches. Finally, you call the Launcher’s Show method to launch the task application.It is important to note that when you use a Launcher, a separate application is launched to complete the task. For example, the EmailComposeTask invokes the Messaging application. When the separate application is launched, your application is deactivated and is no longer running. After completing the task, the user can return to your application, at which point it is reactivated.
Allows an application to launch the Camera application. Use this to allow users to take a photo from your application.
The base class from which all choosers are derived. This class exposes a common function for showing the choosers and an event for handling the chooser result.
Allows an application to launch the Contacts application. Use this to obtain the email address of a contact selected by the user.
Allows an application to launch the email application with a new message displayed. Use this to allow users to send email from your application.
Represents an email address returned from a call to the Show
method of a EmailAddressChooserTask
Allows an application to launch the Windows Phone Marketplace client application and display the details page for the specified product.
Allows an application to launch the Windows Phone Marketplace client application.
This Windows Phone Marketplace Launcher API is deprecated. It will not be supported in future releases. Please use the new Windows Phone Marketplace APIs, MarketplaceDetailTask
, and MarketplaceSearchTask
Allows an application to launch the Windows Phone Marketplace client application and display the review page for the specified product.
Allows an application to launch the Windows Phone Marketplace client application and display the search results from the specified search terms.
Allows an application to launch the media player.
Allows an application to launch the Phone application. Use this to allow users to make a phone call from your application.
Allows an application to launch the Contacts application. Use this to obtain the phone number of a contact selected by the user.
Represents a phone number returned from a call to the Show method of a PhoneNumberChooserTask
Allows an application to launch the Photo Chooser application. Use this to allow users to select a photo.
Represents a photo returned from a call to the Show
method of a PhotoChooserTask
object or a CameraCaptureTask
Allows an application to launch the contacts application. Use this to allow users to save an email address from your application to a new or existing contact.
Allows an application to launch the contacts application. Use this to allow users to save a phone number from your application to a new or existing contact.
Allows an application to launch the Web Search application.
Launches the Messaging application with a new SMS message displayed.
The EventArgs used by the Completed
event for all Choosers.
Allows an application to launch the Web browser application.
EmailComposeTask launches the Email application which displays a new email message. You can optionally specify recipients, a message subject, and a message body that are prepopulated in the new message. The message is not sent until it is initiated by the user.
EmailComposeTask emailComposeTask = new EmailComposeTask();
emailComposeTask.To = "email@example.com";
emailComposeTask.Body = "Email message body";
emailComposeTask.Cc = "firstname.lastname@example.org";
emailComposeTask.Subject = "Email subject";
MarketplaceDetailTask launches the Windows Phone Marketplace client application which then shows the details page for a product specified by the unique identifier you provide.
MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
marketplaceDetailTask.ContentIdentifier = "<ID>";
MarketplaceHubTask launches the Windows Phone Marketplace client application. Set the ContentType property to a value from the MarketplaceContentType enumeration to launch the hub to a particular type of content.
MarketplaceHubTask marketplaceHubTask = new MarketplaceHubTask();
marketplaceHubTask.ContentType = MarketplaceContentType.Music;
MarketplaceDetailTask launches the Windows Phone Marketplace client application which then displays the review page for your application.
MarketplaceReviewTask marketplaceReviewTask = new MarketplaceReviewTask();
MarketplaceSearchTask launches the Windows Phone Marketplace client application which then shows the search results based on search terms you provide.
MarketplaceSearchTask marketplaceSearchTask = new MarketplaceSearchTask();
marketplaceSearchTask.SearchTerms = "accelerometer xna";
MediaPlayerLauncher launches the Media Player application and plays the media file you specify. Media files are stored in isolated storage when saved to disk by the application and are stored in the application’s installation directory if they are bundled into the applications .xap file. You must specify one of these locations using the MediaLocationType enumeration. You can optionally specify that one or more controls should be shown by the Media Player using bitwise OR combinations of the MediaPlaybackControls values.
MediaPlayerLauncher mediaPlayerLauncher = new MediaPlayerLauncher();
mediaPlayerLauncher.Media = new Uri("MyVideo.wmv", UriKind.Relative);
mediaPlayerLauncher.Location = MediaLocationType.Data;
mediaPlayerLauncher.Controls = MediaPlaybackControls.Pause | MediaPlaybackControls.Stop;
PhoneCallTask launches the Phone application and displays the specified phone number and display name. The phone call is not placed until it is initiated by the user.
PhoneCallTask phoneCallTask = new PhoneCallTask();
phoneCallTask.PhoneNumber = "55555555555";
phoneCallTask.DisplayName = "Gage";
SearchTask launches the Search application and performs search query you provide.
SearchTask searchTask = new SearchTask();
searchTask.SearchQuery = "NukeYourOffice";
SmsComposeTask launches the Messaging application which displays a new SMS message. You can optionally specify recipients and a message body that are prepopulated in the new message. The message is not sent until it is initiated by the user.
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = "5555555555";
smsComposeTask.Body = "Check out this new app.";
WebBrowserTask launches the Web browser and displays the URL you provide.
WebBrowserTask webBrowserTask = new WebBrowserTask();
webBrowserTask.URL = http://webservicesuk.com;