Windows Phone 7 advanced services CO6025
Introduction Launchers and Choosers Accelerometer GPS and Maps A set of classes for interacting with underlying phone features/resources, e.g. Camera, Email, SMS etc. Accelerometer GPS and Maps
Launchers and Choosers There is no low level access to phone features Everything is through managed code All features are accessed using phone UI, though data can be communicated from an app. A launcher starts a phone feature A chooser allows you to select an item from phone store The application is tombstoned with some tasks so make sure you save application state
List of Tasks Following features are accessible Photos Media Email Phone Contacts SMS Search Marketplace
Photo access PhotoChooserTask CameraCaptureTask Show() method launches media library browser When photo is selected it returns to your application Completed event fires and returns a stream containing the picture CameraCaptureTask Show method starts the camera When a photo is taken AND accepted it returns to application Completed event fires returning the filename of the taken photo and a stream containing the picture.
Media library access MediaPlayerLauncher MediaLibrary MediaElement Show() method launches the phones media player Can only play the item set in the Media property Item must be from within the application or in the applications own Isolated Storage space. MediaLibrary Can access the contents of the library (e.g. photos, music and video) MediaElement Music and video can be played using the MediaElement class MediaElement works inside the application (i.e. it is not a launcher) Can play local media files too
Email access EmailAddressChooserTask EmailComposeTask Show() method launches a list of contacts for whom you have email addresses Completed event returns an email address if one is selected EmailComposeTask Show() method launches the Email system in the phone pre-populated with the details you provide. There is NO Completed event
Phone access PhoneNumberChooserTask PhoneCallTask Show() method launches a list of contacts for whom you have phone numbers Completed event returns the chosen phone number PhoneCallTask Show() method dials the number you provide in the PhoneNumber property There is no completed event
Contact access SaveEmailAddressTask SavePhoneNumberTask Show() method launches the Contact page and allows you to save the provided email address Can be added to an existing contact or a new contact can be created Completed handler returns an error flag. SavePhoneNumberTask As with SaveEmailAddressTask, but allows the provided PhoneNumber to be save.
SMS access SmsComposeTask Show() method launches the SMS messaging system prepopulated with the provided To and Body properties. The user can click the send button or navigate back. The To and Body fields can be edited before sending.
Search access SearchTask Show() method performs search with the provided SearchQuery property Uses normal Bing search syntax Demo uses ‘domain:www.johnpscott.co.uk’ in the query to restrict search to the tutorial domain Lots of other query filters possible
Marketplace access MarketplaceHubTask MarketplaceSearchTask Show() method launches full MarketPlace site for the provided ContentType (either Music or Applications) MarketplaceSearchTask Show() method searches ContentType for provided SearchTerms MarketplaceDetailTask Show() method displays detail page for the provided App Id. If App Id is null provides details for current app. Useful for allowing a paid update MarketplaceReviewTask Show() method displays reviews page for current App.
Accelerometer Accelerometer class provides access to built in accelerometer Start and Stop method ReadingChanged event returns X, Y and Z acceleration values Values in range -2 to +2 Value of 1 equivalent to normal gravity Application processes values as required
GPS GeoCoordinateWatcher Start and Stop methods StatusChanged event handler PositionChanged event handler Position contains TimeStamp Latitude and Longitude Bearing Speed Horizontal and Vertical accuracy estimate
Bing Map control Drop Map onto design surface By default provides a browse-able interface CredentialProvider required to get rid of watermark message Sign up with Bing for apiKey! Center property can be linked to GPS to provide position tracking Methods provided for positioning other UI elements in correct geo-coordinate location. E.g. LocationToViewportPoint Events to help update UI E.g. ViewChangeOnFrame