[AC-6489] Android: Ti.Media.hasCameraPermissions() not working as expected
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Muhammad Ahmed Fahad |
Assignee | Yordan Banev |
Created | 2020-02-13T03:29:03.000+0000 |
Updated | 2020-02-17T15:51:37.000+0000 |
Description
Ti.Media.hasCameraPermissions() return false even though Camera Permission has been enabled.
Tested using Samsung Galaxy Note8 running on Android 9.0 and Titanium SDK: 9.0.0.v20200211122336
Also tested on Google Nexus 5X running on Android 8.1.0
Testing:
Enable Camera permissions of the app by toggling switch in App Settings Menu
$.addListener($.button, 'click', function () {
alert("Ti.Media.hasCameraPermissions(): " + Ti.Media.hasCameraPermissions());
});
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
[~fahad86] Does the following look similar to your code for the full flow of permissions? I'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
<uses-permission android:name="android.permission.CAMERA" />
in my tiapp. I am able to grant permissions for the gallery, but not for the camera, soTi.Media.hasCameraPermissions()
returns false (correctly). Adding that permission to the tiapp will allow me to be prompted for camera permissions, and thenTi.Media.hasCameraPermissions()
returns true. Additionally, if I only approve the camera permission and not the storage permission thenTi.Media.hasCameraPermissions()
will return false for both 8.3.1.GA and 9.0.0Already had the permission:
[~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. That 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 intiapp.xml
If I got it right you had such a scenario? If you are able to share theandroid
segment of the reproduceable case it will be much easier to find a possible issue.