I have developed one game, it has more images so I am thinking load images from server for every game level complete in my phonegap game. I need to download the images from server to this location
file:///android_asset/www/img
in phonegap game.
how can I achieve this?
I have gone through the tutorial Code for displaying image in phonegap but here they have displayed images on the screen, I dont to save them in img folder..
function storeIntelligrapeLogo() { //alert('start of file download'); var url = "http://androidexample.com/media/webservice/LazyListView_images/image0.png"; // image url window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fs) { //alert('inside request file sysytem') // fs.root.getDirectory(myFolderName, {create:true, exclusive:false}, function (folder){});
var imagePath = 'file:///storage/sdcard0'+fs.root.fullPath + "/logo2.png"; // full file path
// var imagePath = 'file:///android_asset/www/'+fs.root.fullPath + "logo2.png";
// alert('inside request file sysytem path fs.root==' + fs.root);
// alert('inside request file sysytem path fs.root.fullPath==' + fs.root.fullPath);
var fileTransfer = new FileTransfer();
fileTransfer.download(url, imagePath, function(entry) {
// alert(entry.fullPath); // entry is fileEntry object
var dwnldImg = document.getElementById("dwnldImg");
dwnldImg.src = imagePath;
dwnldImg.style.visibility = "visible";
dwnldImg.style.display = "block";
}, function(error) {
alert("Some error" + JSON.stringify(error));
});
}) }
I have tried this example but its storing image in the phone memeory but I need to store images into phonegap img folder
Thanks in advance