User Tools

Site Tools


built_in:downloader

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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:
 +<code>dload = app.CreateDownloader();</code>
  
 ===== Methods ===== ===== Methods =====
-^Method ^Description ^ +^ Method                                   ^ Description                                                                                                                                       
-|Downloader.Download() | | +| 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.IsComplete() | | +| Downloader.GetProgress()                 returns fract value 0..1, but "NaN" if not yet started                                                                                            
-|Downloader.GetProgress() | | +| Downloader.GetSize()                                                                                                                                                                       
-|Downloader.GetSize() | | +| Downloader.IsComplete()                  returns true/false                                                                                                                                
-|Downloader.SetOnComplete(callback) | |+| Downloader.SetOnComplete(callback)       Should be done before starting the download.                                                                                                      | 
 + 
 +=====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) 
 +
 + 
 +</code> 
 + 
 +===== 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.1418933316.txt.gz · Last modified: 2014/12/19 04:08 (external edit)