Camera in Phonegap 2.9.0 does not work

I am using PhoneGap 2.9.0 with a camera API for my iPhone application. When I call a method, it does not work. Here is my code:

Application / Support Files / Cordova.plist

<key>Plugins</key> <dict> <key>Camera</key> <string>CDVCamera</string> </dict> 

config.xml

 <plugin name="Camera" value="CDVCamera" /> 

Capture method

 function capturePhoto() { navigator.camera.getPicture(onPhotoURISuccess, fail, { quality: 50, destinationType: Camera.DestinationType.FILE_URI }); } function onPhotoURISuccess(imageURI) { Ext.Viewport.setMasked({ xtype: 'loadmask', message: 'Loading..', indicator: true }); var options = new FileUploadOptions(); options.fileKey = "file"; options.fileName = imageURI.substr(imageURI.lastIndexOf('/') + 1); options.mimeType = "image/jpeg"; var params = new Object(); params.value1 = "Fastabuy"; options.params = params; options.chunkedMode = false; var URL = imguploadurl + 'pid=&type=single'; //console.log(URL); var ft = new FileTransfer(); ft.upload(imageURI, URL, win, fail, options); /*attendphoto=imageURI; document.getElementById('productpic').src = attendphoto; App.gvars.Productimg=attendphoto; //console.log( App.gvars.Productimg);*/ } var captureSuccess = function (mediaFiles) { for (i = 0, len = mediaFiles.length; i < len; i += 1) { fpath = mediaFiles[i].fullPath; fimage = mediaFiles[i].name; window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotimg, fail); } }; 

I do not know what happened to my code. Please help me sort it out.

+4
source share
1 answer

Make sure you link to the new phonegap / cordova.js file in index.html , for example. <script src="phonegap.js"></script> It falls into the same directory as index.html when the application is created, for example.

  • WWW \
  • - index.html
  • - phonegap.js
  • - img \
  • - css \
  • - js \
  • ...
0
source

Source: https://habr.com/ru/post/1500154/


All Articles