breautek edited a comment 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. I think 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
