05 wp7 launchers and choosers
TRANSCRIPT
Launchersand
Choosers
Jason LeeEthos Technologies
Agenda• Introduction• Full List• Code Example• Execution Model• Event Flow• Play Time• Q & A
Launchers & Choosers• Windows Phone provides a number of functions
• Telephone Call, SMS, Email, Camera, Contacts etc.
• Indirect access to phone features & data• Applications can NOT directly access information such as contacts.• Applications can NOT directly execute behaviors such as phone call or
SMS. • Launchers & Choosers allow applications to access various phone features
and data through them.
• They invoke new applications• Launcher & Chooser APIs invoke distinct built-in applications (which in
turn replace the currently running application, and can go back by hitting Back key)
Launcher• A Launcher
• Launches one of the built-in applications through which a user can complete a certain task
• No data is returned to calling application• Examples :
- PhoneCallTask- SMSComposeTask
Chooser• A Chooser
• Also launches one of the built-in applications through which a user can complete a certain task
• Returns some data to calling application• When a chooser completes, calling application is reactivated and supplied
with the result• A user can cancel the launcher, in which case an empty value is returned• Examples :
- PhoneNumberChooserTask- PhotoChooserTask
Full ListLaunchers
EmailComposeTask
MarketplaceDetailTask
MarketplaceHubTask
MarketplaceReviewTask
MarketplaceSearchTask
MediaPlayerLauncher
PhoneCallTask
SearchTask
SMSComposeTask
WebBrowserTask
Choosers
CameraCaptureTask
EmailAddressChooserTask
PhoneNumberChooserTask
PhotoChooserTask
SaveEmailAddressTask
SavePhoneNumberTask
Using Launchers• Key Points
• Different launchers has different parameters• They all have a Show() method to invoke tasks
• Example 1
• Example 2
Using Choosers• Key Points
• Hook to a Chooser’s Completed event for result data• Use Show() method to invoke tasks
• Example
Execution Model• When Launchers & Choosers are hit
• OnNavigatedFrom event occurs to the page• Deactivated event occurs to the App• Control switches to the task
• While Launchers & Choosers running• There’s no guarantee that the user will come back to your app• If the user navigates away from the task, your app will be dormant, and
therefore has a possibility to be tombstoned eventually• Thus, every stateful application should handle tombstoning
• After Launchers & Choosers complete• Activated event occurs to App• OnNavigatedTo event occurs to the page• The app and page are the same instances if not tombstoned, new
instances if tombstoned.
Event Flow
App
• Without TombstoningPage Task
App()
Launching
Deactivated
Activated
Page()
OnNavigatedTo
OnNavigatedFrom
OnNavigatedTo
Show()
Completed
Do Something
Event Flow
App
• With TombstoningPage Task
App()Launching
Deactivated
Activated
Page()OnNavigatedTo
OnNavigatedFrom
OnNavigatedTo
Show()
App()
Navigates Awayand
Come Back
Page()
Completed Event does NOT occur
Play Time !• Goals
• Get familiar with various Launchers and Choosers• Understand application lifecycle event flow related to Launchers and
Choosers
! & ?
Thank You ! Any Questions ?