user515985
user515985

Reputation: 51

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.

Upvotes: 5

Views: 8560

Answers (3)

Matt Zukowski
Matt Zukowski

Reputation: 4541

In my case it turned out that the onActivityResult I had defined in my Activity was silently interfering with the DroidGap functionality. A super.onActivityResult() call got things working again.

Upvotes: 0

Jeroen Braan
Jeroen Braan

Reputation: 61

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.

Upvotes: 5

user523167
user523167

Reputation: 11

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.

Upvotes: 1

Related Questions