Created
April 7, 2020 17:32
-
-
Save devcrux/81254937950140884d224214a65dc030 to your computer and use it in GitHub Desktop.
Getting geolocation in xamarin forms
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
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