Part 1: Adding a secondary live tile to the start page.
Part 2: Starting a Bing Maps navigation
Part 3: Updating a Live Tile locally (coming soon).
Part 4: Adding your app to Bing Search Extras (coming soon).
The feature
Windows Phone 7 Mango features turn by turn navigation with voice guidance directly integrated in the Bing Maps application. At the time of writing, it is still unclear exactly which countries will be supported. However, for the supported countries (such as the USA), an application can easily start a Bing Maps navigation.Prerequisite
In order to use the GeoCoordinate class or any other location-related feature in your app, you need to add a reference to the System.Device assembly. The class itself is located in the System.Device.Location namespace.How to start a navigation?
Like most interactions between an application and the operating system, this starts with a task: the BingMapsDirectionsTask class.Start a new navigation takes two locations: a Start and an End. The code looks like this:
var bingMapsDirectionsTask = new BingMapsDirectionsTask(); var end = new LabeledMapLocation( 'Shop #1234', shopGeocoordinate); var start = new LabeledMapLocation( 'My location', myGeoCoordinate); bingMapsDirectionsTask.Start = start; bingMapsDirectionsTask.End = end; bingMapsDirectionsTask.Show();
In the code above, the shopGeocoordinate and the myGeocoordinate are two instances of the GeoCoordinate class, where the Latitude and Longitude properies are set. Note that the phone’s own location can be obtained by using a GeoCoordinateWatcher instance, as described on MSDN.
The result
After the Show method is called on the bingMapsDirectionsTask, the application is put in the background and the Bing Maps application starts. The rest is handled by this application, including turn by turn navigation and voice guidance.
Conclusion
Having a GPS in a phone is something I (as a geek) am still not completely over. The possibility to leverage the integrated navigation capabilities instead of having to implement a custom solution is making this task not only much easier, but also a more consistent user experience.
However, the feature relies on Bing Maps, which as we all know by now is not very good outside of the US. Let’s hope that the Nokia deal will improve this service very soon (since Nokia has probably the best worldwide database of maps, location information and POIs (at the exception maybe of Garmin).
Happy (geo)coding!
Laurent
No comments:
Post a Comment