Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.