User Tools

Site Tools


built_in:downloader

Differences

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

Link to this comparison view

built_in:downloader [2015/03/29 11:56]
octazid [Table]
built_in:downloader [2018/04/19 23:14]
Line 1: Line 1:
-====== 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 ===== 
-^ 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 ===== 
-<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> 
- 
-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)