Capacitor Camera not working when using Chrome on Android

Hello,

I am working on migrating my Cordova Ionic app to Capacitor, but I can’t seem to get the camera open for the user when accessing my Ionic web app on Android via Chrome.

When I am on Chrome on Windows or Linux, it opens the camera just fine, and I can take a picture.

When I am on Chrome on Android phone, I click the button to call my selectImage(), and nothing happens.

Here’s my selectImage() code:

  async selectImage() {
    console.log('selectImage() Event Handler');

    const cameraImage = await Plugins.Camera.getPhoto({
      quality: 100,
      allowEditing: false,
      resultType: CameraResultType.Base64,
      source: CameraSource.Photos
    });

    // Do something with cameraImage ...
  }

And here’s info about my Ionic project:

Ionic:

   Ionic CLI                     : 5.4.16 (/home/kmott/.files/bin/node-v10.15.3-linux-x64/node_modules/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.11.10
   @angular-devkit/build-angular : 0.13.8
   @angular-devkit/schematics    : 7.3.8
   @angular/cli                  : 7.3.8
   @ionic/angular-toolkit        : 1.5.1

Capacitor:

   Capacitor CLI   : 2.0.1
   @capacitor/core : 2.0.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : browser 6.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.0, (and 6 other plugins)

Utility:

   cordova-res : not installed
   native-run  : 1.0.0

System:

   NodeJS : v10.15.3 (/home/kmott/.files/bin/node-v10.15.3-linux-x64/bin/node)
   npm    : 6.4.1
   OS     : Linux 4.19

I think I still have some of the Cordova plugins installed, are those causing conflicts maybe, when running in Chrome browser on Android?

–Kyle

For what it’s worth, I am running my testing by starting ionic using this CLI incantation (so I can test & run locally):

ionic capacitor run web --configuration="local"
npx cap serve

Interestingly, I was able to “resolve” this by performing an actual build & deploy using this (running on an Android device using Chrome browser):

ionic capacitor build web --prod --release --configuration="production"

If I just do a run & serve for capacitor, the camera on my phone (using Chrome browser) never opens:

ionic capacitor run web --configuration="production"
npx cap serve