The Launcher and Choosers API allows applications to interact with Native Applications of Windows Phone 7
![LncChsWinphn1.gif]()
Launchers
![LncChsWinphn2.gif]()
- Launchers are a collection of classes in
Windows Phone 7.
- They help to interact with inbuilt
applications on native application of Windows Phone 7.
- Launchers used to launch one of the
inbuilt or native applications from your application.
- Launchers do not return any data from the
inbuilt or native application.
The different Launchers are below,
- EmailComposerTask
- PhoneCallTask
- SmsComposeTask
- MarketPlaceHubTask
- MarketPlaceSearchTask
- MarketPlaceDetailsTask
- MarketPlaceReviewTask
- MediaPlayerLauncher
- WebBrowserTask
- SearchTask
Choosers
![LncChsWinphn2.1.gif]()
- Choosers are collection of classes in
Windows Phone 7.
- They help to interact with inbuilt or
native applications of Windows Phone 7.
- Choosers launch and native application and
returns data from the launched application for further manipulation also.
- Choosers return data to the application
using choosers.
- It's not necessary that all the Choosers
return data. For example SaveEmailAddressTask chooser task does not return
any data to the calling application.
Data
return by the Choosers should be handled in the completed event of the Choosers.
Different choosers are as below,
- CameraCaptureTask
- PhotoChoosersTask
- SaveEmailAddressTask
- EmailAddressChoosersTask
- SavePhoneNumberTask
- PhoneNumberChooserTask
Using Choosers and Launchers in Code
You need to make instance of choosers or launcher to use them. You need to add
below namespace to use various launchers or choosers.
![LncChsWinphn3.gif]()
After creating instance you need to call Show method () as below. There are many
options also you can set with different launchers.
![LncChsWinphn4.gif]()
In case of Chooser you need to handle completed event to work with returned
data.
Good Practice to use Choosers in the code
There are three points you need to keep in mind while working with choosers in
Windows Phone 7. To explain you more I am using PhotoChooserTask
Three points are as below,
Point 1
You need to instantiate Choosers as the global variable on the page of the
application
![LncChsWinphn5.gif]()
Point 2
You need to make sure that you are registering completed event in constructor of
the page.
![LncChsWinphn6.gif]()
Point 3
In the completed event of Chooser, first you need to check for the TaskResult
value. If it is ok then perform the task.
![LncChsWinphn7.gif]()
This is all about Launchers and Choosers. I hope this post is useful. Thanks for
reading.