{ "id": "175523", "key": "TIMOB-28122", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2020-09-10T06:37:00.000+0000", "epic": { "id": 175512, "key": "TIMOB-28114", "name": "TiAPI: Geolocation Parity", "summary": "TiAPI: Geolocation Parity", "color": { "key": "color_1" }, "done": false }, "priority": { "name": "Low", "id": "4" }, "labels": [ "android", "geolocation", "manifest", "permission" ], "versions": [], "issuelinks": [], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2021-02-22T18:36:48.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "*Summary:*\r\nIf the below permission are missing in the app's \"AndroidManifest.xml\" file, then the [Ti.Geolocation.hasLocationPermissions()|https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Geolocation-method-hasLocationPermissions] method wrongly returns {{true}} on OS versions older than Android 6.0.\r\n\r\n*Steps to reproduce:*\r\n# Create a Classic Titanium app project.\r\n# In the \"tiapp.xml\", set {{}} to {{true}} as shown below.\r\n# Use the below \"app.js\".\r\n# Build and run on Android 5.1 or older.\r\n# In the log, notice it wrongly returns {{true}}.\r\n\r\n{code:xml}\r\n\r\n\ttrue\r\n\r\n{code}\r\n\r\n{code:javascript}\r\n// app.js\r\nvar hasPermission = Ti.Geolocation.hasLocationPermissions();\r\nconsole.log(\"@@@ hasLocationPermissions: \" + hasPermission);\r\n{code}\r\n\r\n*Recommended Solution:*\r\nWe should modify the code [here|https://github.com/appcelerator/titanium_mobile/blob/ab87f2e1288bf30cb2f70d9565553ee42c57fee4/android/modules/geolocation/src/java/ti/modules/titanium/geolocation/GeolocationModule.java#L498-L500] to call the Java [Context.checkCallingPermission()|https://developer.android.com/reference/android/content/Context#checkCallingPermission(java.lang.String)] to see if the location permission is defined in the \"AndroidManifest.xml\".\r\n\r\n*Note:*\r\nThe Titanium build system will normally automatically add location permissions to the generated \"AndroidManifest.xml\" file. So, this issue will only happen if this behavior has been overridden via the {{}} property in the \"tiapp.xml\" file. Even if this is the case, the developer should add this locations by hand to the \"tiapp.xml\" file's Android manifest section like how a native developer would do it.\r\n", "attachment": [], "flagged": false, "summary": "Android: Ti.Geolocation.hasLocationPermission() must return false if missing permission in manifest on OS versions older than 6.0", "creator": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }