Windows Phone 8 Dev Guide – Retrieving the Current Location

If you want to retreive the current location from your Windows Phone app , you can use the GetGeopositionAsync method that is defined inn the Windows.Devices.Geolocation.Geolocator class.

How to Get the Current Location from Windows Phone 8 ?

To use the Location and Maps API in your Windows Phone 8 app , it is necessary to set the below capabilities in the WMAppManifest.xml GUI Capabilities tab of your project.


Just create an instance of the Geolocator class and call the GetGeopositionAsync() method to return the Geoposition . The resulting Geoposition’s latitude and longitude can be used to identify the current location which can later be used to display on the map.

Below is a code snippet demonstrating the usage of the GetGeopositionAsync to get the current location.

Geolocator GKlocator = new Geolocator();    
GKlocator.DesiredAccuracy = PositionAccuracy.High; 
Geoposition position = await GKlocator.GetGeopositionAsync(); 
MessageBox.Show(position.Coordinate.Latitude + " , " + position.Coordinate.Longitude);
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Reply


Interesting BlogPosts to read

Download - Pokemon Go for for Windows 10 (Third Party app)
Pokemon Go is one of the popular AR games for android and iOS devices and now , the game is made ava...
Open Wordpad from command line in Windows
You can use the command "Write" from command line in Windows to open the WordPad application.D:\>...
Popular cross-platform (android and iOS) to-do list app
In this blog post, we will cover some of the popular to-do list app that is available on different p...