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

Added support for reduced accuracy detection on iOS 14 #1739

Merged
merged 7 commits into from
Aug 30, 2023

Conversation

leonluc-dev
Copy link
Contributor

@leonluc-dev leonluc-dev commented Mar 24, 2021

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
Collaborator

@jamesmontemagno jamesmontemagno left a comment

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.

Xamarin.Essentials/Geolocation/Geolocation.ios.macos.cs Outdated Show resolved Hide resolved
@jamesmontemagno jamesmontemagno added the awaiting-review This PR needs to have a set of eyes on it label Apr 12, 2021
@leonluc-dev
Copy link
Contributor Author

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

@leonluc-dev
Copy link
Contributor Author

@jamesmontemagno The suggested changes have been applied

@jfversluis jfversluis dismissed stale reviews from ghost and jamesmontemagno via 48398ac April 5, 2022 08:03
@jfversluis
Copy link
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 @jamesmontemagno ?

@jamesmontemagno
Copy link
Collaborator

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

@mina5500
Copy link

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

@jfversluis
Copy link
Member

@mina5500 this is not merged, so unfortunately not.

Copy link
Member

@jfversluis jfversluis left a comment

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.

@jfversluis jfversluis merged commit 6f527db into xamarin:main Aug 30, 2023
10 checks passed
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