jamesmontemagno / GeolocatorPlugin

Geolocation plugin for Xamarin and Windows
MIT License
294 stars 158 forks source link

Xamarin:Listening issue in geoLocator in IOS #286

Closed abhay081994 closed 5 years ago

abhay081994 commented 6 years ago

I an using GeoLocator for current location in xamarin.so when i start listening it shows my current location but when i pause and again start then is shows lat=0,long=0 only in IOS.(in Andorid everything works fine.) This is my Code:

public async void CurrentLocation()
{
try
{
    await CrossGeolocator.Current.StartListeningAsync(TimeSpan.FromSeconds(10), 0, true, new 
    Plugin.Geolocator.Abstractions.ListenerSettings
    {
        ActivityType = Plugin.Geolocator.Abstractions.ActivityType.AutomotiveNavigation,
        AllowBackgroundUpdates = true,
        DeferLocationUpdates = true,
        DeferralDistanceMeters = 1,
        //DeferralTime = TimeSpan.FromSeconds(10),
        ListenForSignificantChanges = false,
        PauseLocationUpdatesAutomatically = false

    });
    CrossGeolocator.Current.PositionChanged += changedPosition;
}
}

public void Start_button()
{
    CurrentLocation();
}
public async void Pause_button()
{
     await CrossGeolocator.Current.StopListeningAsync();
}

please help me and thanks in advance.

jamesmontemagno commented 5 years ago

You should filter these out as I just return what Apple gives me.