Mark A. Rupert
Mark A. Rupert

Reputation: 527

Using FileTransfer API for Phonegap on Android download fails

I am trying to implement the FileTransfer API for my Phonegap App in Javascript. When I call it with the code below I get 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

Code to call 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 this in my Manifest:

I have this in my config:

I have cordova-2.2.0.jar in my libs folder and phonegap-1.3.0.js is an included javascript. I did some debugging in phonegap-1.3.0.js and the error is in the call to prompt:

var r = prompt(JSON.stringify(args), "gap:"+JSON.stringify([service, action, callbackId, true]));

It is returing "29 F08 FileTransfer() sJSON error" this is passed to an eval function which of course fails. It would seem I am missing something in my setup somewhere. Any ideas?

Thanks

Upvotes: 0

Views: 1574

Answers (1)

user206481
user206481

Reputation: 258

You need to have cordova-2.2.0.js if you are using cordova-2.2.0.jar. They need to match. And make sure you have the appropriate one for android.

Upvotes: 0

Related Questions