-
-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IOS getLocationAuthorizationStatus permissionStatus.GRANTED #454
Comments
I have not tested this (it is a theory), but with newer iOS versions there might be some magic going on within iOS itself where it has changed the API but tries to stay semi backwards compatible. Meaning that when you initially request Once cordova.plugins.diagnostic.requestLocationAuthorization(function(status){
console.log(status);
}, function(error){
console.error(error);
}, cordova.plugins.diagnostic.locationAuthorizationMode.WHEN_IN_USE); |
This is a quirk of the iOS Location Manager behaviour of iOS 14+ If you request location permission
Then select "Allow While Using App" in permission dialog, iOS invokes the locationManagerDidChangeAuthorization delegate method with authorization status kCLAuthorizationStatusAuthorizedAlways. The plugin then maps this constant to the Conversely, if you request permission For comparison, if you request Just to be clear, here are those results in tabular form:
It really does seem like Apple has got this backwards as you'd expect having requested location I guess the plugin could "remember" that you'd requested Therefore it's probably best that you handle this anomalous behaviour with your own logic at app-level. |
Bug report
CHECKLIST
I have read the issue reporting guidelines
I confirm this is a suspected bug or issue that will affect other users
Current behavior:
After application deployed and started, I selected the 'Allow while using app' choice as location access on IOS.
The getLocationAuthorizationStatus returns permissionStatus.GRANTED, instead of permissionStatus.GRANTED_WHEN_IN_USE.
After I change to location mode maualy, the selected value will returns the right value to the getLocationAuthorizationStatus function.
But after deploy it is not woking properly.
Expected behavior:
The application should return permissionStatus.GRANTED_WHEN_IN_USE if I select the 'Allow while using app' at first time.
Steps to reproduce:
Screenshots
Environment information
cordova -v
cordova platform ls
cordova plugin ls
sw_vers
winver
Runtime issue
Android build issue:
node -v
ls platforms/android/.gradle
android:targetSdkVersion
inAndroidManifest.xml
sdkmanager --list | sed -e '/Available Packages/q'
iOS build issue:
node -v
14.17.0Related code:
Console output
Location permission setting is granted
console output
Other information:
The text was updated successfully, but these errors were encountered: