Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update(android): android 13 camera open Fixed #839

Closed
wants to merge 3 commits into from

Conversation

rokanraja1
Copy link

@rokanraja1 rokanraja1 commented Jul 15, 2023

Platforms affected

Not Affected any Platform

Description

Android 13 camera not open issue

closes #840

Testing

I was checked Manually

Checklist

  • I've run the tests to see all new and existing tests pass

@rokanraja1 rokanraja1 mentioned this pull request Jul 15, 2023
3 tasks
@DUWENINK
Copy link

why apache so slowly merge this ,I need it ,ばかやろ

@rokanraja1 rokanraja1 marked this pull request as draft July 24, 2023 07:34
@rokanraja1 rokanraja1 marked this pull request as ready for review July 24, 2023 07:34
@breautek breautek closed this Aug 19, 2023
@breautek breautek reopened this Aug 19, 2023
String version = android.os.Build.VERSION.RELEASE;
if(Integer.parseInt(version) <= 13)
{
if(PermissionHelper.hasPermission(this, Manifest.permission.CAMERA)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: have you tested this line, because in my test in android 13 hasPermission is every time false, or you call a request to have permission, or remove this line(my android 13 worked without this if)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CAMERA permission is normally not required, but there is a caveat with the ACTION_MEDIA_CAPTURE API.

Note: if you app targets M and above and declares as using the Manifest.permission.CAMERA permission which is not granted, then attempting to use this action will result in a SecurityException.

Normally the CAMERA permission is only for gaining access to the camera hardware so it's not normally needed when intents. But if something, or someone adds the CAMERA permission to the app's manifest, then the CAMERA permission needs to be granted for the intent to work.

Copy link
Contributor

@breautek breautek Aug 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With that being said, the condition seems to be doing <= android 13 check. But this caveat applies if your app targets M (API 23) or later, which is virtually all apps today. So I think this check will fail if you have an app that declares the CAMERA permission on the next Android version.

@rokanraja1
Copy link
Author

rokanraja1 commented Aug 21, 2023 via email

return;
int[] grantResults) throws JSONException {
String version = android.os.Build.VERSION.RELEASE;
if(Integer.parseInt(version) <= 13)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check may fail, you cannot assume that the user-visible will be number like or an integer.

Instead it should use Build.VERSION.SDK_INT

Which refers to the API level. Android 13 is API 33, which has a constant Build.VERSION_CODES.TIRAMISU

Can you also explain the rationale for adding in a version check for Android 13 and earlier? This is effectively selecting all devies that we support, excluding any newer android versions in the future. So that seems strange to me.

@breautek
Copy link
Contributor

breautek commented Sep 6, 2023

This PR is superseded by Should be fixed by #844

@breautek breautek closed this Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

android 13 camera open issue
4 participants