Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Not able to access current location by geolocator in IOS.

$
0
0

Hello,

I want to access current location's long lat so i am doing it by geo locator but it not coming.
my code is as below:

    public async void GetCurrentLocation()
         {
             try
             {
                    {                

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

                        activityMainData.Longitude = position.Longitude.ToString();

                        activityMainData.Latitude = position.Latitude.ToString();

                        activityMainData.Altitude = position.Altitude.ToString();
                    }
              }

                catch (Exception ex)
                {
                throw ex;
            }
         }

I have give Permission as below:

    NSLocationWhenInUseUsageDescription 
    NSLocationAlwaysAndWhenInUseUsageDescription
    Location Always Usage Description

but i am not getting current long lat
please help me ASAP.Thanks in Advance


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>