NOTE: I was being stupid, for so many things I tried the picture DOES save into my local storage but I kept on checking my gallery (always thought gallery would scan all the images) but somehow it's not in my gallery so I kept on thinking the image didn't save
I'm using phonegap 2.9.0 and playing with the camera API. The phonegap documentation even provided a full html example which you can just copy and paste the code into the www folder and deploy and camera works perfectly just that it wouldn't save the image taken into the local/sd storage. I'm trying to figure out how and been trying for a while can someone give me a hand?
I did do some research before I post this question. I did find a post:
Save image in local storage phonegap
but I tried the code there and somehow it didn't work for me. I also searched a few sites and posts and lots of them just mentioned adding saveToPhotoAlbum: true which was mentioned in the phonegap documentation and I tried which didn't work at all..
I looked through the phonegap 2.9.0 documentation, and saw permissions so I believe I need to add those codes too so I did...
in config.xml I added
<plugin name="Camera" value="org.apache.cordova.CameraLauncher" />
in AndroidManifest I added
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
and in index.html I just used the full example which phonegap. 2.9.0 provided. I think it's too must to paste it here but I believe this is where I need to add something into the code..
// A button will call this function
//
function capturePhoto() {
// Take picture using device camera and retrieve image as base64-encoded string
navigator.camera.getPicture(onPhotoDataSuccess, onFail,{ quality: 50,
destinationType: destinationType.DATA_URL, saveToPhotoAlbum: true });
}
I thought by adding saveToPhotoAlbum: true
would work but doesn't seem like it works though.
Can someone give me a hand? The documentation looks easy but gets frustrated when can't figure out what's wrong (: