Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhoneGap on Android: camera.getPicture success proceedure not being called

I'm checking out PhoneGap API for Android and was trying out the camera sample application example and installed in my Android Phone (2.1 Galaxy S). However after running the app and taking a picture the image was not retrieved. From what I understand in the code, after taking the picture, the image would be displayed in a 60x60 below the button. I tried printing out the base64 value in an alert message but I didn't get any response as well (also no error alerts were displayed). Is there something I missed or should be doing? or did modify the camera function for Android (I'm ueing PhoneGap 0.9.2)

Aside from that, the rest of the function seem to work properly. I was able to load and display the images from the library, etc.

Sample code can be found in the url below http://docs.phonegap.com/phonegap_camera_camera.md.html

Thanks in advance.

like image 763
user515985 Avatar asked Nov 22 '10 11:11

user515985


2 Answers

Try 'uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"' in your manifest file and use 'destinationType: Camera.DestinationType.FILE_URI' for phonegap's getPicture call. I had the same problem and adding WRITE_EXTERNAL_STORAGE permission worked for me.

like image 136
Jeroen Braan Avatar answered Oct 14 '22 22:10

Jeroen Braan


I had similar problems with HTC Desire and basic PhoneGap camera example, but when I changed getPhoto() to use FILE_URI:

function getPhoto() {   
  navigator.camera.getPicture(
      onPhotoURISuccess, 
      onFail, 
      { quality: 50, destinationType: destinationType.FILE_URI }
  );
}

... it started to work fine.

like image 24
user523167 Avatar answered Oct 14 '22 22:10

user523167