You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/09/20 15:41:21 UTC

[GitHub] [cordova-plugin-geolocation] breautek commented on issue #235: !important Android 12 new approximate location and precise location

breautek commented on issue #235:
URL: https://github.com/apache/cordova-plugin-geolocation/issues/235#issuecomment-923045451


   I believe this plugin is already compatible. It seems like if you request `FINE` location, then starting API 31, you **must** also request `COARSE` permission at the same time.
   
   > If your app targets Android 12 and you request the ACCESS_FINE_LOCATION permission, you must also request the ACCESS_COARSE_LOCATION permission. You must include both permissions in a single runtime request. If you try to request only ACCESS_FINE_LOCATION, the system ignores the request and logs the following error message in Logcat: ACCESS_FINE_LOCATION must be requested with ACCESS_COARSE_LOCATION.
   
   The reason why I believe this plugin is already compatible is because we old an array containing both of these permissions here:
   
   https://github.com/apache/cordova-plugin-geolocation/blob/8be9229c44a4a00391a8e1be832758a80fbd5b4c/src/android/Geolocation.java#L41
   
   And when requesting:
   
   https://github.com/apache/cordova-plugin-geolocation/blob/8be9229c44a4a00391a8e1be832758a80fbd5b4c/src/android/Geolocation.java#L100-L103
   
   OR
   
   https://github.com/apache/cordova-plugin-geolocation/blob/8be9229c44a4a00391a8e1be832758a80fbd5b4c/src/android/Geolocation.java#L49-L57
   
   However, the issue with coarse only not working is probably due to the fact that it appears that if any of the requested permissions are denied, then we treat the entire prompt as a denial:
   
   https://github.com/apache/cordova-plugin-geolocation/blob/8be9229c44a4a00391a8e1be832758a80fbd5b4c/src/android/Geolocation.java#L64-L82
   
   This is obviously problematic. It should only throw an error if `highAccuracy` was requested, but `FINE` location is not granted.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org