Guide to Launchers and Choosers

Launchers and choosers are great example of how you can use the Windows Phone 8 platform to add built in functionality to your app in a consistent way. The big benefit except constancy is that you can add quite complex tasks to your app without having to re-invent the wheel or code “nice to have functions” but instead focus on your business goal and app purpose and the best of it all, it’s easy to get started. The biggest difference between launchers and choosers are that launchers launches a task without having some return value while choosers launches a task that returns a value or an item.

Remember, the different launchers and choosers might require capabilities enabled in the app manifest!

Launchers are functionality to launch a task to be performed from your app e.g. a phone call. A note is that when the launcher is executed, the user will leave your app, and might not return. In other words, the app will become dormant or tombstoned. If the user returns, the app will be Activated or Launched at that point. You can often configure the input to a launcher but for some it’s not necessary. A good example for the modification of the input to a launcher is the PhoneCallTask. It requires a phone number to be supplied, but the property for displayname is optional. You can use the PhoneCallTask in your app to provide a phone call functionality with only three lines of code, and still get a consistent UI that the users are familiar with. Below is two code examples for how to add a PhoneCallTask to an app. (The Phone CallTask needs the capability ID_CAP_PhoneDialer.)

Just invoking without display name;

            var phoneCallTask = new PhoneCallTask();
            phoneCallTask.PhoneNumber = m_Customer.PhoneNumber;

Setting the displayname;

            var phoneCallTask = new PhoneCallTask();
            phoneCallTask.PhoneNumber = m_Customer.PhoneNumber;
            phoneCallTask.DisplayName = m_Customer.Name;

The result will be;



There is a great number of Launchers and the complete list are;


Choosers are as I pointed out earlier, something that returns a result, if the user returns. As with launchers, the user will leave the app when the chooser is executed and there is no guarantee that the user will come back. Choosers can be used to improve your app and give you as a developer a shortcut to functionality that you might need e.g. pic a photo from the photo album. When we code the choosers we need to add a callback for when (if) the chooser returns with a result since we leave the app. You will find an example below, of how to pick a photo from the media store and displays it in the UI. In this example we will also add the feature to take a picture with the camera.


        private void Button_Click_1(object sender, RoutedEventArgs e)
            var photoChooserTask = new PhotoChooserTask();
            photoChooserTask.ShowCamera = true;
            photoChooserTask.Completed += photoChooserTask_Completed;

        void photoChooserTask_Completed(object sender, PhotoResult e)
            if (e.ChosenPhoto != null)
                var bitMap = new BitmapImage();
                MyImage.Source = bitMap;

And the result will be;
The list of choosers are shorter than the list for launchers but contains a great deal of nice built in features;



One thought on “Guide to Launchers and Choosers

  1. Pingback: Windows Phone HTML5 hybrid «

Comments are closed.