I followed the guide for using the camera plugin in the browser. In my app.module.ts file I have:
import { Camera } from '@ionic-native/camera';
I am declaring a mock class like so:
export class CameraMock extends Camera {
getPicture(options) {
return new Promise((resolve, reject) => {
resolve('base64-data');
});
}
}
And one item in my array of providers is { provide: Camera, useClass: CameraMock }.
When I run my project in the browser, however, I still receive this message: Native: tried calling Camera.getPicture, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator. When I try ionic cordova run browser instead, I am told that the camera plugin does not support the browser platform.
Please let me know what I'm doing wrong. Thanks!
I've been having the same problem :-(
The problem seems that ocurrs only with Camera. I tested with BarCodeScann and worked fine.