I'm currently working on incorporating the FileTransfer API into my Phonegap App using Javascript. However, when I use the code below to call it, I encounter the following error:
01-24 00:36:10.495: I/Web Console(14802): Error: SyntaxError: Unexpected identifier at file:///android_asset/www/js/phonegap-1.3.0.js:670
Snippet of code to initiate the download:
var fileTransfer1 = new FileTransfer();
fileTransfer1.download(
"http://www.domain.com/images/file.png",
"/sdcard/file.png",
function(entry) {
alert("Download complete: " + entry.fullPath);
},
function(error) {
alert("Upload error code" + error.code);
}
);
I have included relevant details in my Manifest and config files as needed.
I have cordova-2.2.0.jar in my libs directory and phonegap-1.3.0.js as one of the included javascript files. Upon debugging, I found that the error lies in the call to the prompt function:
var r = prompt(JSON.stringify(args), "gap:"+JSON.stringify([service, action, callbackId, true]));
It returns "29 F08 FileTransfer() sJSON error," which is then passed to an eval function and results in a failure. It seems like there might be something missing or misconfigured in my setup. Any suggestions would be greatly appreciated.
Thank you