camera.getPicture returns error 20


I’m building an Ionic 3 app for Android, and am using the camera plugin for choosing a pic from the camera or the photo gallery. It works fine when testing on Samsung Galaxy S4 running Android 5.1, and worked on the Android emulator as well as Nexus 6, but lately, instead of showing the gallery, it returns error message ‘20’ (no description, nada, just the number 20).
Here’s part of the code…

                quality : 75,
                destinationType : Camera.DestinationType.DATA_URL,
                sourceType : Camera.PictureSourceType.CAMERA,
                allowEdit : true,
                encodingType: Camera.EncodingType.JPEG,
                targetWidth: 300,
                targetHeight: 300,
                saveToPhotoAlbum: false
            }).then(imageData => {
                this.base64Image = "data:image/jpeg;base64," + imageData;
       = imageData;
       = this.base64Image;
            }, error => {
                console.log("ERROR -> " + JSON.stringify(error)); // This line shows ERROR -> 20

This only happens on the emulator and Nexus 6 - it works fine on the Galaxy S4.
Any ideas or suggestions? Thanks.


Finally solved it from this solution Camera, ImagePicker permission to access media. It had to do with permissions. For some odd reason, this line

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

vanished from AndroidManifest.xml

I added it back and the photo gallery now pops up.