Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect permission check on iOS for StartListeningAsync + AllowBackgroundUpdates #329

Closed
evan-masseau opened this issue Sep 30, 2020 · 0 comments · Fixed by #333
Closed

Comments

@evan-masseau
Copy link
Contributor

evan-masseau commented Sep 30, 2020

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

  • Configure iOS project with UIBackgroundModes for location, and all the Location Usage descriptions.
  • Invoke CrossGeolocator.Current.StartListeningAsync on iOS, with AllowBackgroundUpdates set to true
  • When prompted for location access permission, select "When In Use" or "Allow Once" (if iOS 13+). Not "Always"

Expected Behavior

  • Geolocator should start listening for location updates. When In Use permission is supposed to be sufficient in the above scenario.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant