android phonegap - is undefined

navigator camera getpicture
cordova camera plugin example
cordova-plugin-camera github

I'm completely new to phonegap. I started with phonegap build - by running 'npm install -g phonegap'. My system is windows7. When i run the command 'phonegap run android' i'm getting console messages as follows:

 [phonegap] detecting Android SDK environment..
 [phonegap] using the local environment
 [phonegap] compiling Android...
 [phonegap] successfully compiled Android app
 [phonegap] trying to install app onto device
 [phonegap] successfully installed onto device

I can see the app running on my device (sony Xperia -E). But when i put in my javascript code:

bindEvents: function() {
    document.addEventListener('deviceready', this.onDeviceReady, false);
// deviceready Event Handler
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicity call 'app.receivedEvent(...);'
onDeviceReady: function() {

    // Update DOM on a Received Event
receivedEvent: function(id) {

    console.log('Received Event: ' + id);

i keep getting alert which say 'undefined'. I checked the same with navigtaor.geolocation, and it wasnt undefined.

I guess it something to do with camera plugin. Am i right?

Please Help

Thanks Forwards

You have to add these things:

--> app/res/xml/plugins.xml

<plugin name="Camera" value="org.apache.cordova.CameraLauncher" />

--> app/AndroidManifest

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> undefined � Issue #498 � apache/cordova-plugin , I have tried it on Android 5.1.1 (emulator device) and Android 7 & 9 on physical devices. While cordova and cordova-plugin-camera plugin is loaded, it says that camera is undefined. Cordova version: 6.1.2 cordova-plugin-camera plugin: 4.1.0. I have tried it on Android 5.1.1 (emulator device) and Android 7 & 9 on physical devices.

After looking itno this project i figured out where was my mistake

I tried to use the 'ondeviceready' eventhandler which comes with index.js.

Dont know why yet, but this handler fires when camera is undefined. After i specified my own handler on the page


function onDeviceReady() {

camera became defined

Undefined object when trying to use , Using the developer app, I'm getting an 'undefined' error when /cant-use- navigator-camera-getpicture-on-ios-phonegap-adobe-build� Dismiss Join GitHub today. GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.

It is supposed to have the cordova-plugin-camera plugin added to your PhoneGap/Cordova project, so just this way you'll get the example working.

See the right command:

cordova plugin add cordova-plugin-camera

Solved: Camera undefined - Adobe Support Community, However, I get multiple errors with the same code when going through phonegap build. Typical: TypeError: undefined is not an object (evaluating 'navigator. PhoneGap API Documentation. I'm able to interact with the camera on my device through the desktop phonegap tool. However, I get multiple errors with the same code when going through phonegap build. Typical: TypeError: undefined is not an object (evaluating '') Why?

Before running phonegap application, make sure you add the lib:

phonegap local plugin add
phonegap local plugin add
phonegap local plugin add

If you omit loading the plugin before building the app it will not work, I also had problems sometimes with installed plugins, so if you did install them, try removing and re-adding them, that worked for me. You can check what plugins are installed by:

phonegap local plugin list

For more information please visit: Official Phonegap Documenattion

Regarding: navigtaor.geolocation it is a standard HTML5 call so if the geolocation plugin is not installed (at least on Android) it will be interpreted as a standard HTML5 geolocation call.

Solved: doens't work, I'm using phonegap with DevExtreme and I'd like to use the phone camera. I searched for the destinationType: I'm trying it on a real Android device. Further I get "Cannot read propetry 'getPicture' of undefined". So, it's� javascript cordova phonegap-plugins cordova-plugins visual-studio-cordova this question edited Jun 4 '15 at 21:59 asked May 29 '15 at 23:06 James 25 6 Is the plugin installed properly in the first place, is the plugin script loaded fully when accessing it somewehere in your project or do you want to access it right after deviceready event has

This worked for me, I guess someone needs to make a release.

cordova plugin remove cordova-plugin-camera && cordova plugin add is undefined., CameraService can't process request because is undefined. appeary io introduce new tab in app setting which is called cordova plugin. you it works fine from the Appery tester app but not from the installed android app. cameraSuccess, cameraError, [ cameraOptions ] ); Description Function camera.getPicture opens the device's default camera application so that the user can take a picture (if [Camera](camera.html).sourceType = [Camera](camera.html).PictureSourceType.CAMERA , which is the default).

cordova-plugin-camera, Miss any of our Open RFC calls?Watch the recordings here! � cordova-plugin- camera. 4.1.0 • Public • Published a year ago. Readme � ExploreBETA � 0� Cordova 3.4.0 no callback onSuccess o onFail para Android 4.3 Pasar y devolver los valores de javascript y android y utilizarlos como plugin de brecha de teléfono Concatenar y minify los archivos del plugin cordova / phonegap

camera.getPicture, getPicture opens the device's default camera application so that the user can take a picture (if Android; BlackBerry WebWorks (OS 5.0 and higher); iOS; Windows Phone 7 ( Mango ); Bada 1.2; webOS� Android Quirks. Android uses intents to launch the camera activity on the device to capture images, and on phones with low memory, the Cordova activity may be killed. In this scenario, the result from the plugin call will be delivered via the resume event. See the Android Lifecycle guide for more information.

Using Camera in Android - PhoneGap, <gap:plugin name="cordova-plugin-camera" source="npm" > <variable True, _ saveToPhotoAlbum : False, _ allowEdit: False} Uncaught TypeError: Cannot read property 'getPicture' of undefined. line 57 column 22. PhoneGap provides a Camera API that has two methods getPicture and cleanup. The getPicture method can be used either to take a photo using the camera or to retrieve a photo from the photo gallery of the device.

  • Have you added config.xml in res -> xml -> configfile in your application?
  • I'm already have config.xml inside myApp\platforms\android\res\xml
  • Do you have this one in your config file <feature name="Camera"> <param name="android-package" value="org.apache.cordova.CameraLauncher"/> </feature>
  • yes i have this node but still undefined...
  • Have you called onDeviceready? In your javascript code?
  • app/res ? you mean platforms/android/res/xml? have no res directory in my app root
  • yap. You should add it in plugin.xml page
  • What do you mean by If you omit loading the plugin before building the app it will not work I have installed my plugin (e.g. background-geolocation) with command you gave, and the phonegap local plugin list does show the plugin, but I get that the plugin is undefined when I do navigator.plugins.backgroundGeoLocation. Do you have any idea why that could be, I am a bit lost with it :/
  • What I mean is that first you add the plugin and only after that you build for your device. I assume you are building locally and not in the cloud. So the right sequence will be, install the plugin, than run phonegap build android or phonegap build ios, then the plugin should work. Having a look at the documentation of the plugin, it says that you have to use the standard cordova geolocation pluging at least once, before using this plugin. Please read: link