jamesmontemagno / GeolocatorPlugin

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

Incorrect permission check on iOS for StartListeningAsync + AllowBackgroundUpdates #329

Closed evan-masseau closed 3 years ago

evan-masseau commented 4 years ago

Bug Information

Version Number of Plugin: 4.6.2 Device Tested On: iPhone iOS 12.4 Simulator Tested On: iOS v11, 12, 13 Version of VS: VS for Mac 2019 8.7.7 Version of Xamarin: Xamarin Forms 4.8 Versions of other things you are using: n/a

Steps to reproduce the Behavior

Expected Behavior

Actual Behavior

Geolocator plugin throws a GeolocationException with permission unauthorized.

Code snippet

            try
            {
                await CrossGeolocator.Current.StartListeningAsync(
                    TimeSpan.FromMilliseconds(5000),
                    50,
                    true,
                    new ListenerSettings
                    {
                        ActivityType = ActivityType.AutomotiveNavigation,
                        AllowBackgroundUpdates = true,
                        PauseLocationUpdatesAutomatically = false,
                        ListenForSignificantChanges = false
                    }
                );
            }
            catch (Exception exception)
            {
//Catches a Geolocator error if I choose "When In Use"
                OnLocationError?.Invoke(this, exception);
            }

PS thanks so much for developing this library, it works great.