how to use phonegap-2.9.0 camera and store in android device?

<strong>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</strong>

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 (:


Change this

destinationType: Camera.DestinationType.DATA_URL


destinationType: Camera.DestinationType.FILE_URI

It will return you the imageuri,For getting the exact location you can make use of filesystem api in phonegap

window.resolveLocalFileSystemURI(imageURI, resolveOnSuccess, fsFail); function resolveOnSuccess(entry) { var fileuri = entry.toURL(); //console.log(fileuri); }


1.destinationType: Camera.DestinationType.DATA_URL

DATA_URL returns base64 string only here image not store in album;

2.destinationType: Camera.DestinationType.FILE_URL

FILE_URL returns image url. here image stored in album.

if u need both i mean base64 string and image stored in album. you need do something


    get url from camera success then use <strong>File API - FileReader (readAsDataURL)</strong> concepts in phonegap

    <ol> <li>FILE_URL better for android DATA_URL crash the app sometimes for out memory error</li> </ol></li> </ul>


  • Store image to Firebase storage from cordova camera plugins on Ionic
  • Odd function behaviour with Tkinter
  • Dispose not working as expected in DirectorySearcher
  • Fluid video height
  • Weird LEFT OUTER JOIN on Includes eager loading of rails 3
  • What is “PHP-standardized” version number strings?
  • Generating random numbers directly inside a .htaccess file
  • Azure Diagnostic is not saving logs in azure tables
  • Linux command line : edit hacked index files
  • How to create virtual printer with iOS Simulator?
  • Can you pass an array from javascript to asp.net mvc controller action without using a form?
  • Why are YouTube videos using 'youtube.com/v' not loading
  • How do I include a SWC in an AS2 Flash project?
  • GAE: Way to get reference to an HttpSession from its ID?
  • Do I need to seed any random number generator before using EVP_PKEY_keygen of OpenSSL?
  • How to add a focus style to an editable ComboBox in WPF
  • Web.config system.webserver errors
  • Create Instant using a negative year
  • How do I configure context broker accept post requests from my remote sensor?
  • saving file generated by TCPDF
  • How do I superscript characters in a UIButton?
  • Eloquent update method change created_at timestamp
  • Webgrid not refreshing after delete MVC
  • Display images in Django
  • iOS: Detect app start via notification press
  • Get data from AJAX - How to
  • Initializer list vs. initialization method
  • FB SDK and cURL: Unknown SSL protocol error in connection to graph.facebook.com:443
  • Is my CUDA kernel really runs on device or is being mistekenly executed by host in emulation?
  • How to limit post in wp_query
  • R: gsub and capture
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • Comma separated Values
  • AngularJs get employee from factory
  • Free memory of cv::Mat loaded using FileStorage API
  • Memory offsets in inline assembly
  • Turn off referential integrity in Derby? is it possible?
  • Checking variable from a different class in C#
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?