PhoneGap 3.3 file plugin not working with me on Android, i tried getFile and getDirectory, and keep giving me Exception
02-20 12:24:34.997: W/System.err(32109): java.net.MalformedURLException: No installed handlers for this URL
02-20 12:24:34.997: W/System.err(32109): at org.apache.cordova.file.FileUtils.getFile(FileUtils.java:684)
02-20 12:24:35.007: W/System.err(32109): at org.apache.cordova.file.FileUtils.access$5(FileUtils.java:679)
02-20 12:24:35.007: W/System.err(32109): at org.apache.cordova.file.FileUtils$16.run(FileUtils.java:349)
02-20 12:24:35.017: W/System.err(32109): at org.apache.cordova.file.FileUtils$24.run(FileUtils.java:473)
02-20 12:24:35.017: W/System.err(32109): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
02-20 12:24:35.017: W/System.err(32109): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
02-20 12:24:35.017: W/System.err(32109): at java.lang.Thread.run(Thread.java:841)
JavaScript Code
downloadAgendaPage = function () {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
}
function gotFS(fileSystem) {
console.log("Emaish: FileSystem Requested");
console.log("Emaish: fileStream.name = " + fileSystem.name);
console.log("Emaish: fileStream.root.name = " + fileSystem.root.name);
fileSystem.root.getFile("text.txt", {create: true, exclusive: false}, gotFileEntry, fail);
}
function gotFileEntry(fileEntry) {
console.log("Emaish: File Gotten");
var uri = encodeURI("http://****/data/MYOEB2013_Agenda.ics");
console.log("Emaish: uri:" + uri);
var sPath = fileEntry.fullPath.replace("text.txt", "Agenda.ics");
console.log("Emaish: sPath:" + sPath);
fileEntry.remove();
var fileTransfer = new FileTransfer();
fileTransfer.download(
uri,
sPath,
function (theFile) {
console.log("download complete: " + theFile.toURI());
//showLink(theFile.toURI());
alertify.alert("Agenda downloaded to " + theFile.toURI());
},
function (error) {
console.log("download error source " + error.source);
console.log("download error target " + error.target);
console.log("upload error code: " + error.code);
}
);
}
Console.log Result
02-20 16:15:37.205: I/chromium(23491): [INFO:CONSOLE(59)] "Emaish: FileSystem Requested", source: file:///android_asset/www/js/agenda.js (59)
02-20 16:15:37.205: I/chromium(23491): [INFO:CONSOLE(60)] "Emaish: fileStream.name = persistent", source: file:///android_asset/www/js/agenda.js (60)
02-20 16:15:37.205: I/chromium(23491): [INFO:CONSOLE(61)] "Emaish: fileStream.root.name = ", source: file:///android_asset/www/js/agenda.js (61)