Windows Phone Essentials #5 – Launchers

September 4, 2012

wp-essentials-05-launchers

I’ve been doing Windows Phone development on and off for the past couple of years. In fact, I recently published the first version of my application “Snap Receipt” to the Windows Phone Marketplace. It’s an easy way to get receipts from your phone into Concur’s expense reporting system. You can check it out here. During my experiences with Windows Phone development I’ve identified 10 essential things developers need to know if they’re going to starting writing code against the platform. I thought I’d take some time to share them with you over a series of posts. Please note, these posts refer to Windows Phone 7.0/7.1. I have yet to see any developer bits for Windows Phone 8, but it is my hope that many of the principles I discuss in this series apply to the new platform as well.

In my last post in this series I discussed Isolated Storage. In this post I’ll look at a feature called “Launchers”.

Let’s start by defining what a launcher is. In short , a launcher enable you to launch one of the built-in, or native, Windows Phone applications. An example of a launcher would be launching the phone application to place a call to a given number. The calling application can provide the phone application with a phone number and a display name. When the Phone application is displayed, the user can choose whether or not to actually initiate the call. When the user closes the Phone application, the calling application is typically activated again.

When working with launchers, you can break them out into three groups of functionality.

launchers-00

The first set has to do with communication

  • EmailComposeTask
  • PhoneCallTask
  • SmsComposeTask

The next group of launchers has to do with the marketplace

  • MarketplaceHubTask
  • MarketplaceSearchTask
  • MarketplaceDetailTask
  • MarketplaceReviewTask

The last group of launchers includes some miscellaneous tasks:

  • MediaPlayerLauncher
  • WebBrowserTask
  • SearchTask

Since you’ll be spending a fair amount of time testing your applications with the emulator there are some key behavioral differences between how some launchers act in the emulator and on an actual device that you need to be aware of. The diagram below indicates which launchers behave differently in the emulator.

launchers-01

  • Since you can’t set up an email account in the emulator, the EmailComposeTask is not functional.
  • Placed phone calls always connect, but since the emulator uses fake GSM and has a false SIM card the connection is a simulated one.
  • Similar to phone calls, SMS message are always sent successfully in the emulator environment.
  • Since you can’t link your emulator to a Windows Live account when you launch the MarketplaceReviewTask an error is displayed as the marketplace requires a windows live id to complete the operation.
  • When using the MediaPlayerLauncer task in the emulator music can be played, but video will not be rendered.

Using a launcher in your Windows Phone application is a three step process:

  1. Instantiate a task type for the launcher.
  2. Set any require and optional properties of the instantiated task.
  3. Call the Show method of the task object.

For detailed “How-To’s” of using specific launchers, you should check out this page on MSDN.

Previous posts in this series