Launching Third-Party Maps From Your Windows Phone 8.1 App

There could be scenarios where you don't really want full control of how maps behave and want the experts (Bing maps, Nokia Maps and many more) to handle it for your, in that case all you need to do is use iy.

  1. Windows.System.Launcher.LaunchUriAsync(uri)  
Now let's get into the details of how to work with each of the major map apps.

Working with Bing Maps

The URI Schema to launch Bing maps is "bingmaps:" and the following is the simple code to launch Bing maps.
  1. private void LaunchBingMaps()   
  2. {   
  3. // The URI to launch   
  4. string uriToLaunch = @"bingmaps:?cp=140.726966~174.006076";   
  5. var uri = new Uri(uriToLaunch);   
  6. Windows.System.Launcher.LaunchUriAsync(uri);   
  7. }   
Other supported parameters are bb (bounding box), lvl (zoom level), where, Q (query term), trfc (traffic), rtp (Route).

Launching Other Map apps

If you want to launch any map app other than Bing maps then:

 

  • ms-drive-to : Launches a third-party map app like Nokia maps or ATT maps in the driving route mode
  • ms-walk-to : Launches a third-party map app in the walking route mode

The parameters that you pass to the URI schema are destination.latitude, destination.longitude or destination.name.

The following is the sample code snippet to launch the third-party map application:

  1. public void LaunchDrive()   
  2. {   
  3. // The URI to launch   
  4. string uriToLaunch = @"ms-drive-to:?destination.latitude=12.8399390"   
  5. "&destination.longitude=77.6770030&destination.name=Electonic city";   
  6. var uri = new Uri(uriToLaunch);   
  7. Windows.System.Launcher.LaunchUriAsync(uri);   
  8. }   
If there is no apps installed on your phone to handle this URI schema then the user will be taken to the stores to search for the apps that handles the URI schema.

If there is more than one app installed to handle this URI schema then there will be a dialog shown to the user to choose the app that needs to handle the schema.

Up Next
    Ebook Download
    View all
    Learn
    View all