Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Android 13 Permissions Issue #26

Open
MigSalsa opened this issue Jan 18, 2023 · 4 comments
Open

Android 13 Permissions Issue #26

MigSalsa opened this issue Jan 18, 2023 · 4 comments

Comments

@MigSalsa
Copy link

Since Android 13 removed the storage permission, the BottomSheetImagePicker.Builder is no longer working because when it goes to BottomSeetImagePicker's onCreate, it goest into the else of the ReadStoragePermission has if it had no permission and get's stuck on a loop on PermissionUtils, because android 13 does not ask for that permission

@BikramDroid
Copy link

Any update on this issue?

@MigSalsa
Copy link
Author

MigSalsa commented Feb 2, 2023

well we manage to find a workaround this issue, before calling the BottomSheetImagePicker.Builder we added the pickMultipleMedia native method.

if(Build.VERSION.SDK_INT >= 33) {
pickMultipleMedia.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly))
}

final product for this was the following :

if(ContextCompat.checkSelfPermission(requireContext(), permission.READ_MEDIA_IMAGES) == PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(requireContext(), permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
if(Build.VERSION.SDK_INT >= 33) {
pickMultipleMedia.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly))
} else {
try {
BottomSheetImagePicker.Builder(BuildConfig.APPLICATION_ID + ".provider")
.cameraButton(ButtonType.Button)
.galleryButton(ButtonType.Button)
.multiSelect(1, maxAllowed)
.peekHeight(R.dimen.peekHeight)

                    .columnSize(R.dimen.columnSize)
                    .requestTag("multi")
                    .show(childFragmentManager, null)
            } catch (e: Exception) {
                Log.e("ERROR", e.toString())
            }
        }

    } else {
        requestStoragePermission()
    }

@siavash-kadkhodai
Copy link

pls upgrade this library for android api 33 and more!!!

this is not work for me

@kroegerama
Copy link
Owner

Please migrate your apps to registerForActivityResult with PickVisualMedia:
https://developer.android.com/training/data-storage/shared/photopicker

I'm gonna archive this repo, because it does not make sense anymore to maintain nowadays.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants