How to Get the Address based on the Co-Ordinates in Windows Phone 8 ?

Below is a sample code snippet that demonstrates how to get the address of the location based on the co-ordinates in Windows Phone 8.

How to Get the Address based on the Co-Ordinates in Windows Phone 8 ?

In the below code snippet , the latitude and longitude is fixed . The Google’s API is used to get the location details by passing it to the WebClient . The WebClient in turn returns the JSON file which contains the location details.

string latitude = "12.898477";
string longitude = "77.6391137";
WebClient client = new WebClient();
client.DownloadStringCompleted += client_DownloadStringCompleted;
string Url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=" + latitude+ "," + longitude +"&sensor=true";
client.DownloadStringAsync(new Uri(Url, UriKind.RelativeOrAbsolute));
// Result
void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
   var data = e.Result.ToList();
}