For downloading files (including zip files) direct to sdcard, you can use the app.CreateDownloader() method like this:
dload = app.CreateDownloader();
Method | Description |
---|---|
Downloader.Download(sourceURI,destPath) | Start download. You can pass a comma seperated list of file urls to download. destPath should be a valid and accessible folder on the device |
Downloader.GetProgress() | returns fract value 0..1, but “NaN” if not yet started |
Downloader.GetSize() | |
Downloader.IsComplete() | returns true/false |
Downloader.SetOnComplete(callback) | Should be done before starting the download. |
dload = app.CreateDownloader(); dload.SetOnComplete( dload_OnComplete ); dload.Download( srcFileUrl, targetDir ); function dload_OnComplete() { // we know download is ready now // (but not if success or not) }
Option | Description |
---|---|
NoDialog | Hides the default download dialog |
Thanks to Dave (forum: https://groups.google.com/d/msg/androidscript/1_SnH886xT4/OlDVPxZ5bDwJ)