Get current location in Xamarin Droid

Now I am working on a map. I want to get the current location coordinates in Xamarin android. How to get the coordinates for the current location?

+4
source share
1 answer

You can use the Crossplatform Geolocator plugin developed by jamesmontemagno.

Get coordinates as:

var locator = CrossGeolocator.Current;
locator.DesiredAccuracy = 50;
var position = await locator.GetPositionAsync (timeoutMilliseconds: 10000);

Console.WriteLine ("Position Latitude: {0}", position.Latitude);
Console.WriteLine ("Position Longitude: {0}", position.Longitude);
+5
source

Source: https://habr.com/ru/post/1613306/


All Articles