Incorrect permission check on iOS for StartListeningAsync + AllowBackgroundUpdates
evan-masseau opened this issue · comments
Evan C Masseau commented
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.