I am working on a ionic cordova project and I am trying to integrate a functionality to take images from either camera or pick from gallery in base64 and for this functionality I am using cordova camera plugin but the plugins is not working in Android 13 device.
when getPicture() method is called, I get error 20. Just the number 20, no description, nothing.
The same code is working in Android 11, it means code is correct. I also tried to ask for READ_MEDIA_IMAGES & READ_MEDIA_VIDEO permission but still the error is persistent.
import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
const options: CameraOptions = {
quality: 100,
sourceType: sourceType,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
}
this.camera.getPicture(options).then((imageData) => {
// imageData is either a base64 encoded string or a file URI
this.imagePath = 'data:image/jpeg;base64,' + imageData;
}, (err) => {
// Handle error
console.log("error taking image: ", err);
});
'@awesome-cordova-plugins/camera/ngx'; check documentation: github.com/danielsogl/awesome-cordova-plugins