bottomsheet-imagepicker icon indicating copy to clipboard operation
bottomsheet-imagepicker copied to clipboard

Android 13 Permissions Issue

Open MigSalsa opened this issue 2 years ago • 4 comments

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

MigSalsa avatar Jan 18 '23 15:01 MigSalsa

Any update on this issue?

BikramDroid avatar Feb 01 '23 12:02 BikramDroid

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()
    }

MigSalsa avatar Feb 02 '23 12:02 MigSalsa

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

this is not work for me

siavash-kadkhodai avatar Nov 11 '23 09:11 siavash-kadkhodai

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.

kroegerama avatar Nov 11 '23 10:11 kroegerama