public interface IDownloadListener
Application programs can implement this interface and register listeners with the system by
calling DownloadSession#addListener(IDownloadListener).
An application program can use the callbacks to listen to a download session for state changes.
To remove the listeners, call DownloadSession#removeListener(IDownloadListener).
SystemCapability.Miscservices#DOWNLOAD| 限定符和类型 | 方法 | 说明 |
|---|---|---|
default void |
onCompleted() |
Called when the current download session is completed.
|
default void |
onFailed(int errorCode) |
Called when the current download session fails.
|
default void |
onPaused() |
Called when the current download session is paused.
|
default void |
onProgress(long receivedSize,
long totalSize) |
Called when the current download session is in process.
|
default void |
onRemoved() |
Called when the current download session is deleted.
|
default void onRemoved()
default void onCompleted()
default void onFailed(int errorCode)
errorCode - Indicates the error code.default void onPaused()
default void onProgress(long receivedSize,
long totalSize)
This callback notifies the application of the received file size and total size.
receivedSize - Indicates the number of received bytes.totalSize - Indicates the total number of bytes.