User Tools

Site Tools


Sidebar

Privacy Policy

News

Version 2.50 is out since Jan 1st 2022


Frequently Asked Questions


Namespaces

Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax

built_in:downloader

Downloader

For downloading files (including zip files) direct to sdcard, you can use the app.CreateDownloader() method like this:

dload = app.CreateDownloader();

Methods

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.

Example code snippet

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)
}

Options

Option Description
NoDialog Hides the default download dialog

Thanks to Dave (forum: https://groups.google.com/d/msg/androidscript/1_SnH886xT4/OlDVPxZ5bDwJ)

built_in/downloader.txt · Last modified: 2018/04/19 23:14 (external edit)