Camera works on iOS, not on Android. Why?

I’ve got an app which I managed to deploy to Android and iOS. The app allows the user to submit a photo or take a picture. This works fine on iOS. On Android, the ‘browse’ dialogue for selecting an image does nothing. No error message is shown, nothing happens.

How to resolve this? How to troubleshoot this?

I’m targeting Android SDK 29, but soon have to switch to SDK 30.

I use mdg:camera@1.5.0. I’m on Meteor 2.2.

I have successfully used this camera in the past: GitHub - cordova-plugin-camera-preview/cordova-plugin-camera-preview: Cordova plugin that allows camera interaction from HTML code

1 Like

Hi,

Here’s our current setup.

cordova:cordova-plugin-camera 4.1.0
cordova:cordova.plugins.diagnostic 5.0.2

The diagnostic is the one used to ask user for permission.

These works for us with target SDK 29 but NOT with 30 as there seems to have been a big change in Android permissions with SDK 30.
We’ve read somewhere that it’s related to cordova that has not updated yet to support the camera permissions of SDK 30.

We’re getting worried that we won’t get it in time for Google Play Store’s deadline in august for submitting SDK 29 apps.

Regards,

Burni

1 Like

Thanks.

I installed this plugin. My app compiled, but when trying to run it on an iOS device, I got console errors I had not seen before:

2021-07-07 11:26:51.608777-0300 {{my app}}[32039:13047307] [DYGLInitPlatform] connection to host has failed: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"

2021-07-07 11:26:51.609776-0300 {{my app}}[32039:13047307] aborting: platform initialization failed

Inside Xcode, I got this:

libsystem_kernel.dylib`__pthread_kill:
0x1bbc4932c <+0>: mov x16, #0x148
0x1bbc49330 <+4>: svc #0x80
→ 0x1bbc49334 <+8>: b.lo 0x1bbc49354 ; <+40>
0x1bbc49338 <+12>: pacibsp
0x1bbc4933c <+16>: stp x29, x30, [sp, #-0x10]!
0x1bbc49340 <+20>: mov x29, sp
0x1bbc49344 <+24>: bl 0x1bbc24e28 ; cerror_nocancel
0x1bbc49348 <+28>: mov sp, x29
0x1bbc4934c <+32>: ldp x29, x30, [sp], #0x10
0x1bbc49350 <+36>: retab
0x1bbc49354 <+40>: ret

Then actually stopping the app (in Xcode) saw the app load on my device. But, test code did not trigger access to the camera.

Thanks.

I first installed cordova:cordova-plugin-camera. My app compiled, and ran in the browser. But, the camera does not work, here. Though this seems to be the norm.

I also installed this diagnostics plugin:

Could it be that is not the one you are referring to?

Running my app via Xcode on my iOS device, the app ran, but I do not seem to be able to trigger the camera.

The following seems to work:

document.addEventListener("deviceready", onCDeviceReady, false);
function onCDeviceReady() {
	console.log(navigator.camera);
}

This returns:

{“DestinationType”:{“DATA_URL”:0,“FILE_URI”:1,“NATIVE_URI”:2},“EncodingType”:{“JPEG”:0,“PNG”:1},“MediaType”:{“PICTURE”:0,“VIDEO”:1,“ALLMEDIA”:2},“PictureSourceType”:{“PHOTOLIBRARY”:0,“CAMERA”:1,“SAVEDPHOTOALBUM”:2},“PopoverArrowDirection”:{“ARROW_UP”:1,“ARROW_DOWN”:2,“ARROW_LEFT”:4,“ARROW_RIGHT”:8,“ARROW_ANY”:15},“Direction”:{“BACK”:0,“FRONT”:1}}

But, I do not seem to be able to trigger the camera. Or I’m doing something wrong.

Would you be able to share code that successfully triggers the camera?