Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.

Added support for reduced accuracy detection on iOS 14 - #1739

Merged
Gerald Versluis (jfversluis) merged 7 commits into
xamarin:mainfrom
leonluc-dev:LocationAccuracyHandling
Aug 30, 2023
Merged

Gerald Versluis (jfversluis) merged 7 commits into
xamarin:mainfrom
leonluc-dev:LocationAccuracyHandling

Conversation

@leonluc-dev

@leonluc-dev leonluc-dev (leonluc-dev) commented Mar 24, 2021 •

Copy link
Copy Markdown
Contributor

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

API Changes

Added:

  • bool Location.ReducedAccuracy { get; set; }
  • bool GeolocationRequest.RequestFullAccuracy { get; set; }

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Updated documentation (see walkthrough)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think beyond my feedback seems fine. XML docs need to be updated, but besides that is good.

@leonluc-dev

Copy link
Copy Markdown
Contributor Author

James Montemagno (@jamesmontemagno) I've adjusted the version check to use the DeviceInfo API as suggested

@leonluc-dev

Copy link
Copy Markdown
Contributor Author

James Montemagno (@jamesmontemagno) The suggested changes have been applied

@jfversluis

Copy link
Copy Markdown
Member

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 James Montemagno (@jamesmontemagno) ?

@jamesmontemagno

Copy link
Copy Markdown
Collaborator

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

@mina5500

Copy link
Copy Markdown

James Montemagno (@jamesmontemagno) Gerald Versluis (@jfversluis)
is it released in Xamarin.Essentials version 1.8.0 ?

@jfversluis

Copy link
Copy Markdown
Member

Mina Girgis Shenouda (@mina5500) this is not merged, so unfortunately not.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this exact code is running in .NET MAUI without too many problems and we have updated Xamarin.Essentials with another major version, so let's do it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

awaiting-review This PR needs to have a set of eyes on it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants