In PhoneGap V 3.3 application i use this function to download a file to the device i added the File and File-transfer plugins and did all the configuration
downloadAgendaPage = function () {
var uri = encodeURI("http://*****/data/***.ics");
window.requestFileSystem(
LocalFileSystem.PERSISTENT, 0,
function onFileSystemSuccess(fileSystem) {
fileSystem.root.getFile(
"dummy.pdf", { create: true, exclusive: false },
function gotFileEntry(fileEntry) {
var sPath = fileEntry.fullPath.replace("dummy.pdf", "");
var fileTransfer = new FileTransfer();
fileEntry.remove();
fileTransfer.download(
uri,
sPath + 'Agenda.ics',
function (theFile) {
console.log("download complete: " + theFile.toURI());
//showLink(theFile.toURI());
alertify.alert("Agenda file " + "Agenda.ics" + " downloaded to your root folder");
},
function (error) {
console.log("download error source " + error.source);
console.log("download error target " + error.target);
console.log("upload error code: " + error.code);
}
);
},
fail);
},
fail);}
I'm debuging the application on nexus 7 running Android 4.4.2, and i got this error message
02-18 12:04:32.514: W/System.err(21031): java.net.MalformedURLException: No installed handlers for this URL
02-18 12:04:32.514: W/System.err(21031): at org.apache.cordova.file.FileUtils.getFile(FileUtils.java:684)
02-18 12:04:32.514: W/System.err(21031): at org.apache.cordova.file.FileUtils.access$5(FileUtils.java:679)
02-18 12:04:32.514: W/System.err(21031): at org.apache.cordova.file.FileUtils$16.run(FileUtils.java:349)
02-18 12:04:32.514: W/System.err(21031): at org.apache.cordova.file.FileUtils$24.run(FileUtils.java:473)
02-18 12:04:32.514: W/System.err(21031): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
02-18 12:04:32.514: W/System.err(21031): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
02-18 12:04:32.514: W/System.err(21031): at java.lang.Thread.run(Thread.java:841)
any help please