[TIMOB-28474] Android: Modify requestLocationPermissions() to also request ACCESS_COARSE_LOCATION
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2021-08-31T16:30:24.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 10.1.0 |
Components | Android |
Labels | android, geolocation, gps, location, permission |
Reporter | Joshua Quick |
Assignee | Gary Mathews |
Created | 2021-06-05T03:23:44.000+0000 |
Updated | 2021-08-31T16:30:24.000+0000 |
Description
*Summary:*
Currently, our
Ti.Geolocation.hasLocationPermissions()
and Ti.Geolocation.requestLocationPermissions()
methods only check/request for the ACCESS_FINE_LOCATION
permission. We should change these APIs to also check/request for ACCESS_COURSE_LOCATION
as well.
*Reason:*
As of Android 12, the location permission dialog will ask the end-user for "Precise" or "Approximate" location precision as shown in the below screenshot.
https://developer.android.com/about/versions/12/approximate-location
!Android12LocationRequest.png|thumbnail!
If we only request for ACCESS_FINE_LOCATION
, then the following error will be logged and the permission request will fail.
ACCESS_FINE_LOCATION must be requested with ACCESS_COARSE_LOCATION
*To-Do:*
Update location permission handling in...
* [GeolocationModule.java](https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/geolocation/src/java/ti/modules/titanium/geolocation/GeolocationModule.java#L494-L539)
* [TiWebChromeClient.java](https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/webview/TiWebChromeClient.java#L86-L119)
*Note:*
This only impacts apps which "target" Android 12 (aka: API Level 31).
Attachments
File | Date | Size |
---|---|---|
Android12LocationRequest.png | 2021-06-05T03:21:12.000+0000 | 134443 |
master: https://github.com/appcelerator/titanium_mobile/pull/12884
FR Passed.