How to use FileTransfer.download on Android

I use Phonegap 1.9.0 on Android, but there are few examples on the Internet, so I'm worried about downloading the file.

var ft = new FileTransfer(); ft.download( "http://www.something.com/test.zip", "test.zip", // <- Trouble 1 function(entry) { alert("success"); }, function(err) { alert(err); // <- Trouble 2 } ); 

1. I do not understand the way of specifying the file path suitable for this argument. How to specify a local path? Or is there any necessary Android.permission?
2. The message "Class not found" is displayed. What is the reason?
3. What is the path in the native Java uploaded file?

+4
source share
3 answers

Yes, Cordova / Phonegap docs are very easy with real-world examples!

+1
source
 // This worked for me var ft = new FileTransfer(); ft.download( "http://www.something.com/test.zip", // what u download "/sdcard/test.zip", // this is the filename as well complete url // fileSystem.root.toURL() + "test.zip", use ios and others function(entry) { alert("success"); alert(JSON.stringify(entry)); }, function(err) { alert(err); alert(JSON.stringify(err)); } ); 

You can check the directory structure in ADT Eclipse DDMS Perspective -> File Explorer

+1
source
 var ft = new FileTransfer(); ft.download( "http://www.something.com/test.zip", // what u download "", // this is dir which u download, right now, it will download to mnt/sdcard/ function(entry) { alert("success"); }, function(err) { alert(err); } ); 
0
source

All Articles