31 Days of Windows Phone | Day #7: Launchers

This post is Day #7 in a series called the 31 Days of Windows Phone.

Yesterday I discussed how to leverage the Application Bar in your Windows Phone application.  Today, we’re going to look at another core piece of functionality for your apps, the Launcher.

What are Launchers?

I often find myself describing Launchers as a “fire-and-forget” mechanism.  You can use them to send email, view a map, take a picture, and more.  We’ll cover each of the Launchers available to you as a developer on this platform.  At the end of this post, there is a downloadable project that includes code samples for each of the Launchers described here.

One thing to remember about some of these Launchers is that in the emulator, some of them just plain don’t work.  For example, the EmailComposeTask assumes you have an email account set up on the device.  Because the emulator prevents you from creating email accounts, you won’t be able to test this.  This is where you should attend my “office hours.”  Each Thursday, in Columbus, OH, I make myself available from 7-9am for application testing on real devices.  Hit me up if you’d like to try yours out.

For each of these Launchers, you will also need to make sure that you have this statement at the top of your code-behind file.  We need a reference to Microsoft.Phone.Tasks.

using Microsoft.Phone.Tasks;

For a quick look at the list of Launchers, here’s what you’ve got so far:

  • BingMapsDirectionsTaskallows you to provide turn by turn directions from either a start AND end point, or from the user’s current location to an end point.
  • BingMapsTask – you can use this task to launch a map with a specific point labeled.
  • ConnectionSettingsTaska task that allows you to direct your users to their wi-fi, bluetooth, and other settings of their device.
  • EmailComposeTask – allows the user to send an email using their email accounts.
  • MarketplaceDetailTask – launches the Windows Phone Marketplace, and takes the user to a specific product offering.
  • MarketplaceHubTask – launched the Windows Phone Marketplace, and allows you to specify a category of applications to show by default.
  • MarketplaceReviewTask – takes the user to the Windows Phone Marketplace to review the current application.
  • MarketplaceSearchTask – launches search results for the Windows Phone Marketplace, based on a search term your user enters (or that you specify.)
  • MediaPlayerLauncher – launches the internal Media Player application, and plays the media file that you specify.
  • PhoneCallTask – launches the Phone application and displays the provided phone number and name.  The phone call isn’t dialed until the user presses “Call.”
  • SearchTask – think of this as a way to provide a Bing search from your application.
  • SMSComposeTask – launches the Messaging application, and presents the user with the ability to send a text message.  You can specify recipients and message body, but the user has to send it.
  • WebBrowserTask – launches the Web Browser, and navigates to the specified URL.

Launching a Launcher

Each of the Launchers certainly have their own set of properties, but after setting any of them up, you need to .Show() them to the user.  To do this, you simply call the Show() method on your Launcher.

As an example, here’s the SMSComposeTask:

SmsComposeTask sct = new SmsComposeTask();
sct.To = "5555555555";
sct.Body = "Call me when you have a chance.  Let's do lunch today.";
sct.Show();

I linked each of the Launcher names above to their MSDN articles, where you can see the properties of each.  It didn’t make much sense for me to replicate the great work they’re doing over there.

Tomorrow, we’re going to talk about Choosers.  The cousins of Launchers, they allow you to get data from your user’s phone (with their permission, of course.)  See you then!

Download the Code

I have included a simple project that uses each of the above Launchers in an example.

download

6 thoughts on “31 Days of Windows Phone | Day #7: Launchers

  1. Hey Jeff,
    Any word on when or if there will be a Bing maps launcher? I know there's the map control which works fine, but for our app, integrating into the phone's native Bing Map app would be a smoother user experience.

    -Jeff

  2. I was actually just looking for that when I wrote this article. I haven't heard specifically about a Bing Maps launcher, so I would assume on Day #1, that it's not there. I'm sure that's something that could be added in the future, however.

    For my example application on Day #13 (Location Services), I ended up using a Map control instead. But you're right, it would be much nicer to just pass a lat/long to the Map Launcher.

  3. Thanks Jeff,

    That's what I thought. If you hear anything about a launcher, let me know.

    -Jeff

  4. Cannot deploy. Getting this instead:

    —— Deploy started: Project: Day7-Launchers, Configuration: Debug Any CPU ——
    Deployment of application to device failed.
    Error: Could not find a part of the path 'C:UsersjblankenburgMy Projects31DaysOfWindowsPhoneDay7-LaunchersDay7-LaunchersPropertiesWMAppManifest.xml'.
    ========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

  5. Believe those who are seeking the truth doubt those who find it.

  6. No one should ever sit in this office over 70 years old, and that I know.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s