Launchers for Maps in Windows Phone 8

The Windows Phone 8 SDK includes 4 different Launchers for Map related functionality. These include

  • MapsTask
  • MapsDirectionsTask
  • MapDownloaderTask
  • MapUpdaterTask

When using the Maps functionality, make sure that you enable the ID_CAP_MAPS and ID_CAP_LOCATION capabilities in the WMAppManifest.xml file.

MapsTask

The MapsTask launcher lets the users to launch the Maps application in Windows Phone 8 .The Maps Task also allows the user to search.

The MapsTask provides the properties Center, Search Term and Zoom Level for the user to use. You must set either the SearchTerm or the Center property or else you will receive the following error

An exception of type ‘System.InvalidOperationException’ occurred in Microsoft.Phone.ni.dll but was not handled in user code

Launchers for Maps in Windows Phone 8

The SearchTerm is used to find the locations on the map. The Center property defines the location that will be used as the position the location to centre of the map.

Below is a sample code snippet that launches the MapsTask launcher and searched and tags the place “domlur” in the map.

MapsTask mapTask = new MapsTask();

mapTask.ZoomLevel = 18;

mapTask.SearchTerm = "Domlur";

mapTask.Show();

 

Launchers for Maps in Windows Phone 8

MapsDirectionsTask

This Launcher opens the Map Application and then displays the map route and the directions based on the source and destination coordinates. The MapsDirectionsTask has 2 important properties Start and End which is of type LabeledMapLocation. The LabeledMapLocation class has 2 properties Label and Location. The Label property is a text and will be used to the pushpin on the map. This property will be used In case the Location (coordinate) property is not set.

Below is a sample code snippet that demonstrates how to use the MapsDirectionsTask to find the directions between 2 places.

MapsDirectionsTask direction = new MapsDirectionsTask();

direction.Start = new LabeledMapLocation("Domlur",null);

direction.End = new LabeledMapLocation("Koranamgala", null);

direction.Show();

Launchers for Maps in Windows Phone 8

MapDownloaderTask

Want to download a Map for offline use? MapDownloaderTask is the launcher to use. The MapDownloaderTask lets the users to download the desired maps for offline use. To use the MapDownloaderTask, just instantiate the MapDownloaderTask class and call the show method of the MapDownloaderTask. This will launch the Maps Download Application. You can now start downloading the maps.

MapDownloaderTask task = new MapDownloaderTask ();

task.Show();

MapUpdaterTask

The MapUpdaterTask verifies the currently downloaded maps and lets the user know if there are any updates for those maps.

Like MapDownloaderTask, the MapUpdaterTask too does not have any property .

MapUpdaterTask task = new MapUpdaterTask();

task.Show();

Launchers for Maps in Windows Phone 8

The MapUpdaterTask would launch the Maps Download application and then checks to see if there are any updates available for the downloaded maps.

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

This blog post will guide you through several effective methods to troubleshoot and resolve the issue of Microsoft Edge not...
Windows 11 offers a range of audio enhancements that can enrich your listening experience. These enhancements include features like virtual...
Windows 11 brings a fresh and visually stunning design to your desktop, and one of the standout features is the...