Skip to content

Instantly share code, notes, and snippets.

@devcrux
Created April 7, 2020 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devcrux/81254937950140884d224214a65dc030 to your computer and use it in GitHub Desktop.
Save devcrux/81254937950140884d224214a65dc030 to your computer and use it in GitHub Desktop.
Getting geolocation in xamarin forms
try
{
var location = await Geolocation.GetLastKnownLocationAsync();
if (location != null)
{
Console.WriteLine($"Latitude: {location.Latitude}, Longitude: {location.Longitude}, Altitude: {location.Altitude}");
}
}
catch (Exception ex)
{
// Unable to get location
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment