Skip to content

FileDownloadListener

Jacksgong edited this page Apr 14, 2016 · 1 revision
Natural callback flow :
pending -> started -> connected -> (progress <->progress) -> blockComplete -> completed
Maybe get follow callback and finish the download:
paused / completed / error / warn
Maybe reuse downloaded file and just get callback flow:
blockComplete -> completed
function description update
pending Pending for download soFarBytes、totalBytes
started Finish pending, and start the download runnable for the task -
connected Connected to the remote file server ETag、IsResumeBreakpoint、 soFarBytes、totalBytes
progress Download progress soFarBytes
blockComplete Callback before the 'completed callback' sync in the new thread -
retry Callback before automatically retry download Throwable、RetryingTimes、soFarBytes
completed Succeed download and completed -
paused Paused download and over soFarBytes
error Occur error and over Throwable
warn There is already an identical task(same url & same path) being downloaded(pending/connected/process/retry) -

Calling methods in the FileDownloadListener too fast leads to Missing Screen Frames?

Your have 2 ways to handle this problem:

  1. FileDownloader#enableAvoidDropFrame, The default is enabled.
  2. BaseDownloadTask#setSyncCallback, The default is false, if true will invoke callbacks of FileDownloadListener directly on the download thread(do not post the message to the ui thread).
Clone this wiki locally