Cloud Training (Online)

Specifying the Accuracy when retrieving the Location in Windows Phone App

In one of my previous blog post, I demonstrated how to get the current location in Windows Phone 8 using the Geolocator class. The Geolocator class allows the developers to specify the desired accuracy to either High or Default.

This will done by setting the DesiredAccuracy property of the Geolocator class to one of the below PositionAccuracy Enum.

  • Default
  • High

In case of the default value, the Operating System will decide the accuracy level and prefers the usage of cell tower and Wifi to identify the location. This is also one of the power optimized technique than GPS.

If the High value is used, the Operating System prefers GPS (if available) and thus provide better accuracy but at the cost of the reduced battery life.

Geolocator locator = new Geolocator();

// Desired Accuracy of High

locator.DesiredAccuracy = PositionAccuracy.High;

//Default Accuracy

locator.DesiredAccuracy = PositionAccuracy.Default;

The Geolocator class also exposes the property DesiredAccuracyInMeters which also lets the Operating System to choose the location providers for identifying the location. When this property is set with a non-null value, the DesiredAccuracy value is overridden. The lower the value will make the phone prefer the GPS.

Geolocator locator = new Geolocator();

locator.DesiredAccuracyInMeters = 20;
Senthil Kumar B
Senthil Kumar is a former Microsoft MVP (Most Valuable Professional). He is a Co-Author of the book "Windows 10 Development Recipes using JavaScript and CSS" for Apress Publication. He is a technical presenter, blogger, mentor and a Geek.  Senthil is a regular speaker is various local user groups. He has presented at conferences like Great Indian Developer Summit (GIDS) & Microsoft DevCamps. You can reach out to him via his Twitter handle @isenthil.