DownloadManager.Listener


interface DownloadManager.Listener

Known direct subclasses
TestDownloadManagerListener

Allows tests to block for, and assert properties of, calls from a DownloadManager to its DownloadManager.Listener.


Listener for DownloadManager events.

Summary

Public functions

Unit
onDownloadChanged(
    downloadManager: DownloadManager!,
    download: Download!,
    finalException: Exception?
)

Called when the state of a download changes.

Unit
onDownloadRemoved(downloadManager: DownloadManager!, download: Download!)

Called when a download is removed.

Unit
onDownloadsPausedChanged(
    downloadManager: DownloadManager!,
    downloadsPaused: Boolean
)

Called when downloads are (paused or resumed.

Unit
onIdle(downloadManager: DownloadManager!)

Called when there is no active download left.

Unit
onInitialized(downloadManager: DownloadManager!)

Called when all downloads have been restored.

Unit
onRequirementsStateChanged(
    downloadManager: DownloadManager!,
    requirements: Requirements!,
    @Requirements.RequirementFlags notMetRequirements: Int
)

Called when the download requirements state changed.

Unit
onWaitingForRequirementsChanged(
    downloadManager: DownloadManager!,
    waitingForRequirements: Boolean
)

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.

Public functions

onDownloadChanged

fun onDownloadChanged(
    downloadManager: DownloadManager!,
    download: Download!,
    finalException: Exception?
): Unit

Called when the state of a download changes.

Parameters
downloadManager: DownloadManager!

The reporting instance.

download: Download!

The state of the download.

finalException: Exception?

If the download is transitioning to STATE_FAILED, this is the final exception that resulted in the failure.

onDownloadRemoved

fun onDownloadRemoved(downloadManager: DownloadManager!, download: Download!): Unit

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

fun onDownloadsPausedChanged(
    downloadManager: DownloadManager!,
    downloadsPaused: Boolean
): Unit

Called when downloads are (paused or resumed.

Parameters
downloadManager: DownloadManager!

The reporting instance.

downloadsPaused: Boolean

Whether downloads are currently paused.

onIdle

fun onIdle(downloadManager: DownloadManager!): Unit

Called when there is no active download left.

Parameters
downloadManager: DownloadManager!

The reporting instance.

onInitialized

fun onInitialized(downloadManager: DownloadManager!): Unit

Called when all downloads have been restored.

Parameters
downloadManager: DownloadManager!

The reporting instance.

onRequirementsStateChanged

fun onRequirementsStateChanged(
    downloadManager: DownloadManager!,
    requirements: Requirements!,
    @Requirements.RequirementFlags notMetRequirements: Int
): Unit

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 notMetRequirements: Int

RequirementFlags that are not met, or 0.

onWaitingForRequirementsChanged

fun onWaitingForRequirementsChanged(
    downloadManager: DownloadManager!,
    waitingForRequirements: Boolean
): Unit

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.

waitingForRequirements: Boolean

Whether this manager has one or more downloads that are not progressing for the sole reason that the Requirements are not met.