0

I am having compatibility issues for devices running on android 13 after updating the minimum target sdk to 33.

Image Gallery Issue "Error 20" whenever I try to upload an image from the device image gallery which prevents me from opening the image gallery.

Attempted Solution

Updated android manifest by adding the new set of permissions

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

Old set of permissions still remain for backwards compatibility with older versions

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

CameraLauncher.java ( Commented permission denied code )

public void onRequestPermissionResult(int requestCode, String[] permissions,
                                      int[] grantResults) throws JSONException {
    for (int r : grantResults) {
        // if (r == PackageManager.PERMISSION_DENIED) {
        //     this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, PERMISSION_DENIED_ERROR));
        //     return;
        // }
    }
    switch (requestCode) {
        case TAKE_PIC_SEC:
            takePicture(this.destType, this.encodingType);
            break;
        case SAVE_TO_ALBUM_SEC:
            this.getImage(this.srcType, this.destType, this.encodingType);
            break;
    }
}

Project Specification

  1. Ionic V3
  2. Cordova
Yeo Bryan
  • 331
  • 4
  • 24

0 Answers0