Search code examples
cordovaphonegap-build

navigator.camera is undefined on Phonegap Build


I'm trying to use the core plugin cordova-plugin-camera to retrieve image from album. But when I put :

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

I always have "undefined". So the function won't work

I put my cordova.js before & after all others scripts, both don't work.

In my config xml I put :

<plugin name="cordova-plugin-camera" spec="~4.0.3" />

Even :

<feature name="Camera">
  <param name="android-package" value="org.apache.cordova.camera.CameraLauncher" />
</feature>

But still the same issue..

I don't know where to check anymore My phonegap version :

<preference name="phonegap-version" value="cli-7.0.1" />

Do you know where is the problem ?

Thanks


Solution

  • I finally found a solution by downgrading the plugin to 2.4.1 (with cli-7.1.0).