Many people ask me why Windows Phone 7 does not allow access to native functionality in order to accomplish common tasks, such as sending SMS and e-mails, via our own applications. Well, you may not have direct access, but the Windows Phone 7 API offers indirect access to almost every common phone feature in the form of Launchers and Choosers.
If you're in a hurry, just download a complete demo which illustrates the use of every Launcher and Chooser. Read on to understand how things work... ;-)
Let's begin with the definitions: Launchers start a native application and return no data to the calling application (such as opening a web browser). Choosers, on the other hand, start a native application and return some data back to the calling application (such as opening the contact list and selecting a particular phone number). We'll now see how Launchers and Choosers behave separately, as well as how they can be combined to work together!
Both Launchers and Choosers are found under Microsoft.Phone.Tasks namespace, so do not forget to include it in your application.
Using a Launcher is pretty straightforward. Simply declare a phone-Task object, assign values to its properties and then call Show() method. Let's see specific examples:
Using a Chooser is a little more complex. Choosers return a value, so, most of the times, we need to get this value through the Chooser's Completed event handler. Let's see how this can be done for each Chooser:
What happens when you need more advanced functionality? For example, suppose you may want to select a phone number (PhoneNumberChooserTask) and then send an SMS (SmsComposeTask). Two or more tasks have to be used together in this case. Fortunately, the process is as easy as defining a phone task inside the Completed event handler of another task!
Finally, you can download a complete demo which uses all of the above Launchers and Choosers in a single Windows Phone application. Enjoy!
Note: There are a few more tasks which are absent from this blog post (MarketplaceDetailTask, MarketplaceHubTask, MarketplaceReviewTask and MarketplaceSearchTask specifically). These tasks are used exactly like the ones presented here, but I have excluded them from my demo because the Marketplace is not yet finalized.
Excellent article and demo code. While I was aware of all this functionality already, it is certainly handy to have a single demo project which demonstrates it all.
Thank you, Nick. I really appreciate your comment.
ok.how can make encrypt and decrypt sms ? I don't have access to inbox/outbox .... Encryption it is easy with SmsComposeTask but decryption ????? How can get the incoming sms ?
The functionality you are asking for is not yet feasible. Microsoft will probably add it in future releases, but, as far as I know, nothing relevant has been announced.
The only solution I can think of is replacing SMS with Push Notifications (web services and database storage), but it's quite hard to implement.
Have a look at this article, too: http://bit.ly/fRgIwD
Thanks for some quality points there. I am kind of new to online , so I printed this off to put in my file, any better way to go about keeping track of it then printing?
I have infer from a only one of the articles on your website now, and I extremely like your style of blogging. I added it to my favorites trap stage muster and will be checking back soon. Cheer report register out of order my site as approvingly and let me be familiar with what you think. Thanks.
Hallo an euch alle , ich gerade gelesen Ihr Schreiben hier und mochte genießen Sie Aufstehen mit große Schrift !
Good Work , gut wohnen und auch frohe Weihnachten und einen guten Rutsch ins neue Jahr 2011! Sorry bad Deutsch!
awesome blog, do you have twitter or facebook? i will bookmark this page thanks. jasmin holzbauer
nice post. thanks.
very good ;)
Powered by Zimbra