DownloadManager.Listener
public interface DownloadManager.Listener
TestDownloadManagerListener |
Allows tests to block for, and assert properties of, calls from a |
Listener for DownloadManager events.
Summary
Public methods |
|
|---|---|
default void |
onDownloadChanged(Called when the state of a download changes. |
default void |
onDownloadRemoved(DownloadManager downloadManager, Download download)Called when a download is removed. |
default void |
onDownloadsPausedChanged( |
default void |
onIdle(DownloadManager downloadManager)Called when there is no active download left. |
default void |
onInitialized(DownloadManager downloadManager)Called when all downloads have been restored. |
default void |
onRequirementsStateChanged(Called when the download requirements state changed. |
default void |
onWaitingForRequirementsChanged(Called when there is a change in whether this manager has one or more downloads that are not progressing for the sole reason that the |
Public methods
onDownloadChanged
default void onDownloadChanged(
DownloadManager downloadManager,
Download download,
@Nullable Exception finalException
)
Called when the state of a download changes.
| Parameters | |
|---|---|
DownloadManager downloadManager |
The reporting instance. |
Download download |
The state of the download. |
@Nullable Exception finalException |
If the download is transitioning to |
onDownloadRemoved
default void onDownloadRemoved(DownloadManager downloadManager, Download download)
Called when a download is removed.
| Parameters | |
|---|---|
DownloadManager downloadManager |
The reporting instance. |
Download download |
The last state of the download before it was removed. |
onDownloadsPausedChanged
default void onDownloadsPausedChanged(
DownloadManager downloadManager,
boolean downloadsPaused
)
Called when downloads are (paused or resumed.
| Parameters | |
|---|---|
DownloadManager downloadManager |
The reporting instance. |
boolean downloadsPaused |
Whether downloads are currently paused. |
onIdle
default void onIdle(DownloadManager downloadManager)
Called when there is no active download left.
| Parameters | |
|---|---|
DownloadManager downloadManager |
The reporting instance. |
onInitialized
default void onInitialized(DownloadManager downloadManager)
Called when all downloads have been restored.
| Parameters | |
|---|---|
DownloadManager downloadManager |
The reporting instance. |
onRequirementsStateChanged
default void onRequirementsStateChanged(
DownloadManager downloadManager,
Requirements requirements,
@Requirements.RequirementFlags int notMetRequirements
)
Called when the download requirements state changed.
| Parameters | |
|---|---|
DownloadManager downloadManager |
The reporting instance. |
Requirements requirements |
Requirements needed to be met to start downloads. |
@Requirements.RequirementFlags int notMetRequirements |
|
onWaitingForRequirementsChanged
default void onWaitingForRequirementsChanged(
DownloadManager downloadManager,
boolean waitingForRequirements
)
Called when there is a change in whether this manager has one or more downloads that are not progressing for the sole reason that the Requirements are not met. See isWaitingForRequirements for more information.
| Parameters | |
|---|---|
DownloadManager downloadManager |
The reporting instance. |
boolean waitingForRequirements |
Whether this manager has one or more downloads that are not progressing for the sole reason that the |