Skip to content

filedownloader.properties

Jacksgong edited this page Jun 25, 2017 · 8 revisions

You can customize the FileDownloader Engine by add filedownloader.properties file in your project module assets folder. For example: /demo/src/main/assets/filedownloader.properties

Format: keyword=value.

Maybe in the code format would be more readable.

keyword description default
http.lenient if you occur exception: 'can't know the size of the download file, and its Transfer-Encoding is not Chunked either', but you want to ignore such exception, set true, will deal with it as the case of transfer encoding chunk. false
process.non-separate The FileDownloadService runs in the separate process ':filedownloader' as default, if you want to run the FileDownloadService in the main process, just set true. false
download.min-progress-step The min buffered so far bytes. Used for adjudging whether is time to sync the downloaded so far bytes to the database and make sure. More small more frequent, then download more slowly, but will safer in the scene of the process is killed unexpectedly. 65536
download.min-progress-time The min buffered millisecond.Used for adjudging whether is time to sync the downloaded so far bytes to the database and make sure. More small more frequent, then download more slowly, but will safer in the scene of the process is killed unexpectedly. 2000
download.max-network-thread-count The maximum network thread count for downloading simultaneously, scope [1,12] 3
file.non-pre-allocation Whether doesn't need to pre-allocates the 'content-length' space when start downloading false
broadcast.completed Whether need post a broadcast when a task is completed false

If you want to use broadcast.completed and receive completed broadcast, you also need to declare filedownloader.permission.RECEIVE_STATE permission on the manifest, and register receiver with filedownloader.intent.action.completed action name and please using FileDownloadBroadcastHandler class to parse the received Intent.