Added support for reduced accuracy detection on iOS 14
Description of Change
iOS 14 added the ability for users to grant location permission with reduced accuracy. In such cases the requested accuracy is ignored and the coarse location is returned.
This PR adds:
- A property indicating if the retrieved location has reduced accuracy (if true, the accuracy was intentionally reduced by the user through permission settings)
- A property to ask the user for temporary full accuracy authorization in the location request
Platform notes:
- The
ReducedAccuracyproperty always returns false on non-iOS platforms - As described in the Apple documentation; on iOS the temporary full accuracy request requires a purpose description to be added to the
NSLocationTemporaryUsageDescriptionDictionaryin the app's plist file. The keyXamarinEssentialsFullAccuracyUsageDescriptionwas used for this purpose.
Bugs Fixed
- Fixes issue #1523
API Changes
Added:
bool Location.ReducedAccuracy { get; set; }bool GeolocationRequest.RequestFullAccuracy { get; set; }
PR Checklist
- [X] Has tests (if omitted, state reason in description)
- [X] Has samples (if omitted, state reason in description)
- [X] Rebased on top of
mainat time of PR - [X] Changes adhere to coding standard
- [ ] Updated documentation (see walkthrough)
@jamesmontemagno I've adjusted the version check to use the DeviceInfo API as suggested
@jamesmontemagno The suggested changes have been applied
Not sure if we should still pull this in for Xamarin.Essentials since it's adding APIs but at the same time it also supports newer iOS functionalities. THoughts @jamesmontemagno ?
I'm relatively fine with it if we do a 1.8.0
@jamesmontemagno @jfversluis is it released in Xamarin.Essentials version 1.8.0 ?
@mina5500 this is not merged, so unfortunately not.