DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


Sidebar

News

Version1.42 is out since December 2nd 2016


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 15:14 by 78.209.123.22