Sponser Link

How to get current location latitude and longitude in android and iOS using xamarin

You can get location in xamarin using Xamarin.Essentials.Geolocation class. In this class, you will find given below methods.lient.

        GetLocationAsync(GeolocationRequest request);
        GetLocationAsync(GeolocationRequest request, CancellationToken cancelToken);

We will use GetLocationAsync in this example. This function will coordinates using device GPS.

      var location = await Geolocation.GetLocationAsync();
                    if (location != null)
                    	      double _log = location.Longitude;
		             double _lat = location. Latitude;

You can call this function as per your requirement. Longitude and latitude will be restoring in _log and _lat variables. On call GetLocationAsync() function, system ask for allow location if location is not enable.