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

Not compatible with Android 13 #110

Open
jainam69 opened this issue Apr 3, 2023 · 3 comments
Open

Not compatible with Android 13 #110

jainam69 opened this issue Apr 3, 2023 · 3 comments

Comments

@jainam69
Copy link

jainam69 commented Apr 3, 2023

Actually in Android 13, android uses android.permission.READ_MEDIA_IMAGES instead of android.permission.READ_EXTERNAL_STORAGE
Can you please make it this compatible with Android 13?

@Zhuinden
Copy link

I downloaded the sources for the library, included it in my project as a module, and edited the following line:

GrantPermissions.java:

-             if (permission.granted) {
+            if (permission.granted || "android.permission.READ_EXTERNAL_STORAGE".equals(permission.name)) {

@antaki93
Copy link

antaki93 commented Nov 14, 2023

Try to download the library resources and replace code of interactors.PermissionUtil.getReadAndWriteStoragePermissions() method:

public static String[] getReadAndWriteStoragePermissions(boolean internal) {
        if (Build.VERSION.SDK_INT >= 33) {
            return new String[] { "android.permission.READ_MEDIA_IMAGES" };
        } else {
            if (internal) {
                return new String[] { Manifest.permission.READ_EXTERNAL_STORAGE };
            } else {
                return new String[] {
                        Manifest.permission.WRITE_EXTERNAL_STORAGE,
                        Manifest.permission.READ_EXTERNAL_STORAGE
                };
            }
        }
    }

And add to AndroidManifest.xml:

<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />

It helped me.

@Zhuinden
Copy link

Yes, that is more correct than what I mentioned, you do need android.permission.READ_MEDIA_IMAGES on SDK 33+.

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

No branches or pull requests

3 participants