Created
November 4, 2014 03:41
-
-
Save wirasetiawan29/34c674307566ed8b277f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task<string> TrackLocation() | |
{ | |
Geolocator geoloc = new Geolocator(); | |
Geoposition position = await geoloc.GetGeopositionAsync(); | |
HttpClient httpClient = new HttpClient(); | |
httpClient.BaseAddress = new Uri("http://nominatim.openstreetmap.org"); | |
HttpResponseMessage httpResult = await httpClient.GetAsync( | |
String.Format("reverse?format=json&lat={0}&lon={1}", position.Coordinate.Latitude, position.Coordinate.Longitude)); | |
JsonObject jsonObject = JsonObject.Parse(await httpResult.Content.ReadAsStringAsync()); | |
return jsonObject.GetNamedObject("address").GetNamedString("road") + DateTime.Now.ToString("‘ (‘HH:mm:ss')'"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment