Ionic Camera doesn't work on Crosscall Devices

Hi everyone,

I have a problem with the ionic-camera pluging on a specific android device (Crosscall Core M5). When I call getPicture() i see two prompt for user permission (camera and library) but the camera won’t appear. I got no error … no log …
My problem only appear on this device … I got no problem with other android’s phone or IOS’s phone.

		const options: CameraOptions = {
			quality: 70,
			destinationType: this.camera.DestinationType.DATA_URL,
			encodingType: this.camera.EncodingType.JPEG,
			mediaType: this.camera.MediaType.PICTURE,
			correctOrientation: true,
			targetWidth : 720,
		}

		this.camera.getPicture(options).then((imageData) => {
			this.myphoto = 'data:image/jpeg;base64,' + imageData;
			console.log("Hi") // <-- Never catch
		}, (err) => {
			console.log(err) // <-- Never catch
		});

I tried to try/catch the all block but still the same result with no logs/errors

I already saw similar post with no answer on github like :

At the same time, I saw some post about problems with camera and Android 13 but my device is 11 … So it’s not my case :frowning:

And finaly I found that there is some updates with Android Permission, but it’s not my case too because when i push my action button to take a picture, there is two prompt to ask permission … So I guess si not a solution too

One more information about permission, I use a plugin to read QR Code and I have no probleme for launching and showing the camera … So I guess my problem is not about Android permission …

So here I am, with my bad english level (as my code’s skill), looking for a super hero to save me. Any help would be appreciate, doesn’t matter if you are Batman or Robin :upside_down_face:

Thank you for your help

It maybe the android version that’s running on those devices. Instead of using the chrome inspector, use the Android Studio logs, it should show an error there when clicking on getPicture(). Worst case scenario, let your users know yourapp don’t support those devices.

1 Like

:open_mouth: Thank you for this wonderful idea !!!

I will try to add “cameraDirection” option but i’m not very confident

If it doesn’t work i can now search about “setting default camera” !

Anyway I will post my research here !

1 Like

Maybe try the @capacitor/camera plugin instead.

Hello again

SO ! Thanks to you and your wonderful answer, i found a path to a working solution !

First i add some line to my config.xml :

I got another error with unbound prefix, so I add some stuff to the previous github link following this other link :

Then I got a new error with my gradle version (3.3.0). Then i update to 3.3.3 following this github link :

And finally my camera work 100% with android-targetSdkVersion 30 !!!

Thank you so much for your answer, it was simple but so helpfull. It was my first post on a forum, in my mind it was my last attempt to solve my problem.

Thank you so much for taking the time to reply to my post.

1 Like

You’re welcome! Happy coding!