App Restart when capture image from camera (Ionic 5)

Viewed 152

Steps :

  1. Click on camera button in app then camera open
  2. take picture front/back picture dsiplay
  3. selection option cancel or ok then I have click ok
  4. app restart (means app open from start page with splase screen)

Notes :

  1. My android version 11 [I am testing this code in android 11(MI device) and android 10(Motorola) devices]
  2. All the permissions of camera access is 100% set.
  3. The issue doesn't come in Android 10.
  4. The issues comes in just Android 11.

This is my Code snippet

const options: CameraOptions = {
  quality: 100,
  destinationType: this.camera.DestinationType.FILE_URI,
  encodingType: this.camera.EncodingType.JPEG,
  mediaType: this.camera.MediaType.PICTURE
}

this.camera.getPicture(options).then((imageData) => {
  console.log("imageData ===> ",imageData);
 // imageData is either a base64 encoded string or a file URI
 // If it's base64 (DATA_URL):
 let base64Image = 'data:image/jpeg;base64,' + imageData;
}, (err) => {
  console.log("errr",err);
  this.utilServices.openForSuccessError({ value: false, message1: err});
  
 // Handle error
});
0 Answers
Related