0

Issue Capturing Images in Ionic Framework on Certain Android Devices

I'm encountering an issue with image capturing functionality in my Ionic Framework project, specifically on certain Android devices. Here's the relevant function: async captureImage(imageType: string) { console.log("imageType ##", imageType); // Create a loader const loader = await this.loadingCtrl.create({ message: 'Capturing image...', }); // Present the loader await loader.present(); this.camera.getPicture(this.cameraOptions).then((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; // Update the appropriate property in registrationData based on imageType if (imageType === 'passportPhoto') { this.registrationData.passportPhoto = base64Image; this.updateForm.get('passportPhoto')?.setValue(base64Image); } else if (imageType === 'signature') { this.registrationData.signature = base64Image; this.updateForm.get('signature')?.setValue(base64Image); } else if (imageType === 'frontId') { this.registrationData.frontId = base64Image; this.updateForm.get('frontId')?.setValue(base64Image); } else if (imageType === 'backId') { this.registrationData.backId = base64Image; this.updateForm.get('backId')?.setValue(base64Image); } console.log('Form control value ###', this.updateForm.get(imageType)?.value); // Dismiss the loader loader.dismiss(); }, (err) => { console.log(err); // Handle error // Dismiss the loader in case of an error loader.dismiss(); }); } The issue is that while this function works on some Android devices, it fails on others. I've tested it on multiple devices, and it seems to be inconsistent. Could anyone provide insights or suggestions on why this might be happening and how to address it? Any help would be greatly appreciated!

4th Apr 2024, 9:37 AM
ALEX MWAURA
5 Réponses
0
ALEX MWAURA , Is that C, C++, C#, something else? Please also add a tag for whatever language that is, not just the framework.
4th Apr 2024, 2:05 PM
Rain
Rain - avatar
0
Knight , That's nice, but the OP needs to put it in a tag.
4th Apr 2024, 6:52 PM
Rain
Rain - avatar