Cordova plugin works on emulator but not in browser

I am using cordova-plugin-camera to allow users to take pictures from their camera. This works in the emulator when I run it as android but it gives TypeError: Cannot read property 'getPicture' of undefined in browser

I believe your Cordova plugins are not supposed to work in the browser. For the browser you could use an input of type file which triggers OS’ feature to pick a file from local storage or camera. There might be some limitations here with Android where some vendor versions of android might not offer the Camera option in the files source selection.

How can i identify in which platform the app run. So that i can hide the button in browser

You can query ‘Meteor.isCordova’ . Check Meteor docs

If (Meteor.isCordova) { … have a button }

@perumalkuk @paulishca Thank you :slight_smile: