Camera plugin not defined

1,054 views
Skip to first unread message

Lee Davies

unread,
Jul 31, 2013, 8:16:05 AM7/31/13
to phon...@googlegroups.com
Developing on Windows 7 with Cordova 3.0. All paths set up (even Git).

Using GitBash I created a new project, added Android as a platform, and added several plugins (Camera, Media, etc.). All are correctly displayed when I typed:

cordova plugin ls

Outputs this:

[ 'org.apache.cordova.core.AudioHandler',
 
'org.apache.cordova.core.camera',
 
'org.apache.cordova.core.file',
 
'org.apache.cordova.core.file-transfer',
 
'org.apache.cordova.core.media-capture' ]

So I'm assuming they're all installed correctly -- even though I encountered this error when installing media-capture (not my post, but same error). 

In my "index.js" file I've changed the event listeners to:

    onDeviceReady: function() {
       
// BackboneJS app
        console
.log("Device ready, creating backBone app...");
       
var photolan = new mediaList();
   
}

... with mediaList() being a BackBone JS view. I can see the console.logs in Eclipse when the app is launched so know there's nothing wrong with the Backbone code.

However, the function that calls the camera intent:

takePhoto: function() {
 console
.log("Taking photo");
 navigator
.camera.getPicture(this.onImageSuccess, this.onImageFail, { quality: 75,
    destinationType
: Camera.DestinationType.FILE_URI });
 
},

... gives this error (I can see the "taking photo" console text):

Uncaught ReferenceError: Camera is not defined at file:///android_asset/www/js/photolan/view_app.js:23

I've looked in the AndroidManifest and config.xml files and both have the appropriate includes and references to the camera -- so I'm a bit stumpped at this. Thoughts?

Bao Ping Tang

unread,
Sep 24, 2013, 2:40:43 AM9/24/13
to phon...@googlegroups.com
hi, 
     Have you check the path of cordova.js ?

     Try this:   

      change           
      <script type="text/javascript" charset="utf-8" src="cordova-3.0.0.js"></script>

      to
     <script type="text/javascript" charset="utf-8" src="cordova.js"></script>





Chris Alexander

unread,
Oct 8, 2013, 4:14:57 PM10/8/13
to phon...@googlegroups.com
Lee,

Did you eventually solve this issue? I am experiencing the same and my head is bumpy from banging it on the table. Any feedback would be appreciated. Thanks.
Reply all
Reply to author
Forward
0 new messages