This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
built_in:downloader [2014/12/18 20:08] bcarroll created |
built_in:downloader [2018/04/19 23:14] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Downloader ====== | ====== Downloader ====== | ||
+ | For downloading files (including zip files) //direct to sdcard//, you can use the app.CreateDownloader() method like this: | ||
+ | < | ||
===== Methods ===== | ===== Methods ===== | ||
- | ^Method ^Description ^ | + | ^ Method |
- | |Downloader.Download() | | | + | | Downloader.Download(sourceURI, |
- | |Downloader.IsComplete() | | | + | | Downloader.GetProgress() |
- | |Downloader.GetProgress() | | | + | | Downloader.GetSize() |
- | |Downloader.GetSize() | | | + | | Downloader.IsComplete() | returns true/ |
- | |Downloader.SetOnComplete(callback) | | | + | | Downloader.SetOnComplete(callback) |
+ | |||
+ | =====Example code snippet ===== | ||
+ | <code javascript> | ||
+ | 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 | ||
+ | | NoDialog | ||
+ | |||
+ | Thanks to Dave (forum: https:// |