diff --git a/plugin.xml b/plugin.xml index 80462f50..383f7087 100644 --- a/plugin.xml +++ b/plugin.xml @@ -99,6 +99,11 @@ + + + + + diff --git a/src/android/ImagePicker.java b/src/android/ImagePicker.java index 6456d9f3..3149e678 100644 --- a/src/android/ImagePicker.java +++ b/src/android/ImagePicker.java @@ -186,13 +186,18 @@ public void onRequestPermissionResult(int requestCode, String[] permissions, int @SuppressLint("InlinedApi") private boolean hasReadPermission() { return Build.VERSION.SDK_INT < 23 || - PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(this.cordova.getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE); + PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(this.cordova.getActivity(), Manifest.permission.READ_EXTERNAL_STORAGE) || + PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(this.cordova.getActivity(), Manifest.permission.READ_MEDIA_IMAGES); } @SuppressLint("InlinedApi") private void requestReadPermission() { if (!hasReadPermission()) { - cordova.requestPermissions(this, PERMISSION_REQUEST_CODE, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}); + if (Build.VERSION.SDK_INT < 33) { + cordova.requestPermissions(this, PERMISSION_REQUEST_CODE, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}); + } else { + cordova.requestPermissions(this, PERMISSION_REQUEST_CODE, new String[]{Manifest.permission.READ_MEDIA_IMAGES}); + } return; } callbackContext.success(1);