cordova-plugin-camera: navigator.camera undefined when using cordova-android@10.1.0

If I install this plugin from npm, navigator.camera is undefined. If I install the plugin using https://github.com/apache/cordova-plugin-camera.git instead of npm, navigator.camera is defined as expected. This appears to be because of the cordovaDependencies defined in package.json.

Is cordova-android 10 supported, or do I need to wait for 6.0.0 to be released? (The comments in https://github.com/apache/cordova-plugin-camera/issues/756 seem to suggest this plugin is expected to work with cordova-android 10.)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

@sirbarkley do you have xmlns:android="http://schemas.android.com/apk/res/android" on the <widget> element in your config file?

That was it. Thank you very much!

@sirbarkley do you have xmlns:android="http://schemas.android.com/apk/res/android" on the <widget> element in your config file?

@SimonBrazell I have this in my config.xml:

<custom-config-file target="AndroidManifest.xml" parent="/*">
  <queries>
    <intent>
      <action android:name="android.media.action.IMAGE_CAPTURE" />
    </intent>
    <intent>
      <action android:name="android.intent.action.GET_CONTENT" />
    </intent>
  </queries>
</custom-config-file>

(I use cordova-custom-config in my config for some other reasons, but I believe you could actually use <edit-config> if you wanted to.)

This is based on https://github.com/apache/cordova-plugin-camera/pull/684 (which has some other intents included as well, but I only needed the above).