programming4us
programming4us
MOBILE

Introducing Windows Phone 7 Launchers and Choosers

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
When a third-party application runs on a Windows Phone, it runs in an execution environment that is highly restricted. The Windows Phone OS must be restrictive in order to protect unsuspecting users of mobile devices from potential malicious application behavior, which may include stealing personal data stored on the phone, dialing phone numbers without users' knowledge, or corrupting other applications' data stores. One of the major restrictions that Windows Phone OS places on mobile applications is limiting them to their own execution environment, or sandbox, and not allowing them access to other applications' space or internals of the operating system.

Yet many applications need to access the system features of the phone, to play a music file in the media library, for example, or to take a photo, or to send a text message or an e-mail. Windows Phone 7 OS enables such application interactions with the device via a set of Application Programming Interface (API) tasks referred to as launchers and choosers. It is relatively easy to use launchers and choosers from within your application, but when one is invoked or when a user presses hardware buttons on the phone, managing application state does get a little tricky.

Introducing Windows Phone 7 Launchers and Choosers

When an application executes, the Windows Phone 7 OS confines it to its own space, or sandbox. Both memory and file storage are isolated within that sandbox—one application cannot access or alter another's memory or file storage. Neither can one application directly call another or access a shared data store—such as a list of contacts, for example. There are obvious reasons for this behavior; Microsoft must ensure that the Windows Phone 7 platform is as secure and stable as possible, and isolating applications is one giant step toward getting there.

There is a set of built-in APIs that provide access to the most common features of Windows Phone 7. These APIs help us perform tasks, such as saving a contact's e-mail address or phone number, or placing a phone call (with the mandatory prior user authorization, of course), that require access to shared resources on the phone.

Launchers and choosers, which can be thought of as system functions provided by the Windows Phone OS, provide you with the means to call into these applications. The difference between a launcher and a chooser is small but important: choosers provide a return value into the calling application, whereas launchers do not. If you think about a task of composing an e-mail message, for example, then it is sufficient to "fire and forget" an e-mail application, allowing users to create and send an e-mail. A launcher is an ideal solution for this task. On the other hand, an application allowing us to select a photo from the photo library on the phone needs to pass the selected photo to our application. Windows Phone 7 provides a chooser to perform such a task.

An important concept to remember is that launchers and choosers are separate applications. Since one of the core design principles behind Windows Phone 7 is to maximize battery life, only one application is allowed to execute on the phone at any time. Therefore, if you invoke a launcher or chooser from within your application, that launcher or chooser will replace your application and become the running application. Depending on the circumstances, your application may enter one of several states when that happens. Tables 1 and 2 list the launchers and choosers available on the Windows Phone 7 platform today. You'll find all of them in the Microsoft.Phone.Tasks namespace; therefore, to use any of them, be sure to import that namespace into your application.

1. Launchers

Table 1 lists launchers offered on the Windows Phone 7 platform, together with a brief description of functionality offered by each one of those launchers.

Table 1. Windows Phone 7 Launchers and Their Functions
LauncherFunction
EmailComposeTaskLaunch the e-mail application with a new message displayed.
MarketplaceDetailTaskLaunch the Windows Phone Marketplace client application and display the details page for the specified product.
MarketplaceHubTaskLaunch the Windows Phone Marketplace client application.
MarketplaceReviewTaskLaunch the Windows Phone Marketplace client application and display the review page for the specified product.
MarketplaceSearchTaskLaunch the Windows Phone Marketplace client application and display the search results from the specified search terms.
MediaPlayerLauncherLaunch the media player.
PhoneCallTaskLaunch the Phone application; use this to allow users to make a phone call from your application.
SaveEmailAddressTaskLaunch the Contacts application; use this to allow users to save an e-mail address from your application to a new or existing contact.
SavePhoneNumberTaskLaunch the Contacts application; use this to allow users to save a phone number from your application to a new or existing contact.
SearchTaskLaunch the Web Search application.
SmsComposeTaskLaunch the SMS application.
WebBrowserTaskLaunch the Web Browser application.

2. Choosers

Table 2 lists and describes the choosers available on the Windows Phone 7 platform.

Table 10.2. Windows Phone Choosers and Their Functions
ChooserFunction
EmailAddressChooserTaskLaunch the Contacts application and obtain the e-mail address of a contact selected by the user.
CameraCaptureTaskLaunch the Camera application and allow users to take a photo from your application.
PhoneNumberChooserTaskLaunch the Contacts application and obtain the phone number of a contact selected by the user.
PhotoChooserTaskLaunch the Photo Chooser application and select a photo .


Other  
  •  Java Mobile Edition Security : Development and Security Testing (part 3) - Code Security & Application Packaging and Distribution
  •  Java Mobile Edition Security : Development and Security Testing (part 2) - Reverse Engineering and Debugging
  •  Java Mobile Edition Security : Development and Security Testing (part 1) - Configuring a Development Environment and Installing New Platforms & Emulator
  •  Java Mobile Edition Security : Configurations, Profiles, and JSRs
  •  Programming the Mobile Web : Performance Optimization
  •  Programming the Mobile Web : Testing and Debugging (part 3) - Client-Side Debugging
  •  Programming the Mobile Web : Testing and Debugging (part 2) - Server-Side Debugging & Markup Debugging
  •  Programming the Mobile Web : Testing and Debugging (part 1) - Remote Labs
  •  Windows Phone 7 : Working with Controls and Themes - Adding Transition Effects
  •  Windows Phone 7 : Working with Controls and Themes - Understanding Frame and Page Navigation
  •  
    Top 10
    - Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
    - Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
    - Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
    - Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
    - Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
    - Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
    - Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
    - Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
    - Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
    - Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
    REVIEW
    - First look: Apple Watch

    - 3 Tips for Maintaining Your Cell Phone Battery (part 1)

    - 3 Tips for Maintaining Your Cell Phone Battery (part 2)
    programming4us programming4us
    Celebrity Style, Fashion Trends, Beauty and Makeup Tips.
    programming4us
     
     
    programming4us