{ "id": "174731", "key": "AC-6489", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": null, "resolutiondate": null, "created": "2020-02-13T03:29:03.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "updated": "2020-02-17T15:51:37.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "Ti.Media.hasCameraPermissions() return false even though Camera Permission has been enabled.\r\n\r\nTested using Samsung Galaxy Note8 running on Android 9.0 and Titanium SDK: 9.0.0.v20200211122336\r\nAlso tested on Google Nexus 5X running on Android 8.1.0\r\n\r\n\r\nTesting: \r\nEnable Camera permissions of the app by toggling switch in App Settings Menu\r\n\r\n{code:javaScript}\r\n$.addListener($.button, 'click', function () {\r\n alert(\"Ti.Media.hasCameraPermissions(): \" + Ti.Media.hasCameraPermissions());\r\n}); \r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: Ti.Media.hasCameraPermissions() not working as expected", "creator": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "subtasks": [], "reporter": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "environment": null, "comment": { "comments": [ { "id": "454234", "author": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "body": "Please look into this issue as soon as possible. This seems to be the only issue following our upgrade to 9.0.0 version of the titanium SDK", "updateAuthor": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "created": "2020-02-13T03:31:03.000+0000", "updated": "2020-02-13T03:31:03.000+0000" }, { "id": "454240", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "[~fahad86] Does the following look similar to your code for the full flow of permissions? \r\n\r\nI'm seeing the same behaviour as you're describing on 8.3.1.GA and 9.0.0, but only if I don't have {{}} in my tiapp. I am able to grant permissions for the gallery, but not for the camera, so {{Ti.Media.hasCameraPermissions()}} returns false (correctly). Adding that permission to the tiapp will allow me to be prompted for camera permissions, and then {{Ti.Media.hasCameraPermissions()}} returns true.\r\n\r\nAdditionally, if I only approve the camera permission and not the storage permission then {{Ti.Media.hasCameraPermissions()}} will return false for both 8.3.1.GA and 9.0.0\r\n\r\n{code}\r\nvar win = Ti.UI.createWindow({});\r\nvar lbl = Ti.UI.createLabel({\r\n text: 'click1',\r\n top: 200\r\n});\r\nvar lbl2 = Ti.UI.createLabel({\r\n text: 'click2',\r\n top: 300\r\n});\r\nlbl.addEventListener('click', () => {\r\n Ti.Media.requestCameraPermissions((e) => {\r\n console.log(e);\r\n });\r\n});\r\nlbl2.addEventListener('click', () => {\r\n alert(\"Ti.Media.hasCameraPermissions(): \" + Ti.Media.hasCameraPermissions());\r\n});\r\nwin.add(lbl);\r\nwin.add(lbl2);\r\nwin.open();\r\n{code}\r\n", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2020-02-13T10:46:15.000+0000", "updated": "2020-02-13T10:46:15.000+0000" }, { "id": "454278", "author": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "body": "Already had the permission: \r\n\r\nAlso accepted the Media Storage access. But issue gets fixed only after adding:\r\n\r\n\r\nThis wasn't the case with 8.3.1. Had the attribute: android:maxSdkVersion=\"18\" on the WRITE_EXTERNAL_STORAGE permission and it was working till 8.3.1. But removed the attribute now and all ok.", "updateAuthor": { "name": "fahad86", "key": "fahad86", "displayName": "Muhammad Ahmed Fahad", "active": true, "timeZone": "Asia/Shanghai" }, "created": "2020-02-14T09:15:30.000+0000", "updated": "2020-02-14T09:15:30.000+0000" }, { "id": "454302", "author": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "body": "[~fahad86] Since Titanium 8.0.0.GA the minimum Android version required is 19, meaning that the addition of {{android:maxSdkVersion=\"18\"}} will not have effect. As for why it was causing the error - Google recently fixed an error on their end that was causing a single permission to grant all the permissions of a group, so explicitly marking the WRITE_EXTERNAL_STORAGE for API levels up to 18 would mess up the expected permissions for external storage.\r\nThat being said I was not able to reproduce the issue against the current master version of Titanium (9.1.0) without having the WRITE_EXTERNAL_STORAGE added in {{tiapp.xml}} If I got it right you had such a scenario? If you are able to share the {{android}} segment of the reproduceable case it will be much easier to find a possible issue.", "updateAuthor": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "created": "2020-02-17T15:51:37.000+0000", "updated": "2020-02-17T15:51:37.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }