dpa99c / cordova-diagnostic-plugin

Cordova/Phonegap plugin to manage device settings
539 stars 361 forks source link

Android 13 - getLocationAuthorizationStatus() return WRONG statuses for ACCESS_COARSE_LOCATION in some cases #481

Closed expcapitaldev closed 2 years ago

expcapitaldev commented 2 years ago

Bug report

CHECKLIST

Current behavior: https://github.com/dpa99c/cordova-diagnostic-plugin#getlocationauthorizationstatuses return WRONG statuses example:

  1. call getlocationauthorizationstatuses and app plugin return NOT_REQUESTED for all permissions ACCESS_BACKGROUND_LOCATION, ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION
  2. call cordova.plugins.diagnostic.requestLocationAuthorization(qwe=>console.log(qwe),qwe=>console.error(qwe),cordova.plugins.diagnostic.locationAuthorizationMode.WHEN_IN_USE,cordova.plugins.diagnostic.locationAccuracyAuthorization.FULL) and choose "approximately" and only "just this time" -> result authorized_when_in_use - ok it is expected
  3. call again getlocationauthorizationstatuses, we will have
  4. open location settings on device and enable ACCESS_FINE_LOCATION
  5. call again getlocationauthorizationstatuses and for ACCESS_FINE_LOCATION we will have DENIED_ALWAYS and it is wrong status

Expected behavior: step 5: call again getlocationauthorizationstatuses and for ACCESS_FINE_LOCATION expected status is GRANTED/ GRANTED in use

Steps to reproduce: see Current behavior

Screenshots do not need

Environment information

Android build issue:

Related code:

see Current behavior

Console output

console output ``` // Paste any relevant JS/native console output here ```


**Other information:**
dpa99c commented 2 years ago

This behaviour is a quirk of Android rather than a bug with this plugin:

I hope this makes sense - the permissions system in Android is a mess and sometimes unintuitive. However this plugin can't change that behaviour therefore I hope you understand why I'm now closing this issue.

expcapitaldev commented 2 years ago

@dpa99c thanks for the quick and detailed answer, good evening and good luck!