Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Evento Async para pegar as coordenadas atual do usuário
private async void StartGeoLocation()
{
try
{
City city = new City();
if (city.GetCurrencyCity() == null)
{
//TODO Preciso verificar o load da localizacao
Geolocator geolocator = new Geolocator();
geolocator.DesiredAccuracyInMeters = 50;
Geoposition geoposition = await geolocator.GetGeopositionAsync(
maximumAge: TimeSpan.FromMinutes(5),
timeout: TimeSpan.FromSeconds(10)
);
SetCurrentLocation(geoposition.Coordinate.Latitude, geoposition.Coordinate.Longitude);
}
else
{
SetCurrentLocation(city.GetCurrencyCity().latitude, city.GetCurrencyCity().longitude);
}
}
catch (Exception ErroStartLocation)
{
System.Diagnostics.Debug.WriteLine("Error load");
}
}
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.