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开发者_C百科.md.html
Thanks in advance.
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.
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.
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.
精彩评论