Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28474] Android: Modify requestLocationPermissions() to also request ACCESS_COARSE_LOCATION

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2021-08-31T16:30:24.000+0000
Affected Version/sn/a
Fix Version/sRelease 10.1.0
ComponentsAndroid
Labelsandroid, geolocation, gps, location, permission
ReporterJoshua Quick
AssigneeGary Mathews
Created2021-06-05T03:23:44.000+0000
Updated2021-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

FileDateSize
Android12LocationRequest.png2021-06-05T03:21:12.000+0000134443

Comments

  1. Gary Mathews 2021-06-11

    master: https://github.com/appcelerator/titanium_mobile/pull/12884
  2. Lokesh Choudhary 2021-08-31

    FR Passed.

JSON Source