Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

Added support for reduced accuracy detection on iOS 14

Open leonluc-dev opened this issue 4 years ago • 4 comments

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 ReducedAccuracy property 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 NSLocationTemporaryUsageDescriptionDictionary in the app's plist file. The key XamarinEssentialsFullAccuracyUsageDescription was 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 main at time of PR
  • [X] Changes adhere to coding standard
  • [ ] Updated documentation (see walkthrough)

leonluc-dev avatar Mar 24 '21 14:03 leonluc-dev

@jamesmontemagno I've adjusted the version check to use the DeviceInfo API as suggested

leonluc-dev avatar Apr 13 '21 14:04 leonluc-dev

@jamesmontemagno The suggested changes have been applied

leonluc-dev avatar Apr 16 '21 09:04 leonluc-dev

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 ?

jfversluis avatar Apr 05 '22 09:04 jfversluis

I'm relatively fine with it if we do a 1.8.0

jamesmontemagno avatar Apr 06 '22 16:04 jamesmontemagno

@jamesmontemagno @jfversluis is it released in Xamarin.Essentials version 1.8.0 ?

mina5500 avatar Aug 28 '23 13:08 mina5500

@mina5500 this is not merged, so unfortunately not.

jfversluis avatar Aug 30 '23 09:08 jfversluis