Interface DownloadManager

interface DownloadManager {
    addDownload(uri: string, options?: DownloadOptions): Promise<number>;
    getAllDownloads(): Download[];
    getDownload(id: number): null | Download;
    removeDownload(id: number): boolean;
}

Methods

  • Adds a new download.

    The returned promise may be rejected if some of the download options are invalid, or if download cannot be performed due to platform-dependent reasons.

    Parameters

    • uri: string

      The full URI of the content that should be downloaded. Supports HTTP, HTTPS, and data URI.

    • Optionaloptions: DownloadOptions

      The download options.

    Returns Promise<number>

    The ID of the download.

    PermissionRequiredException

    IllegalStateException Unsupported URI.

  • Returns all available downloads.

    Returns Download[]

  • Returns a previously added download.

    Parameters

    • id: number

      The ID of the download.

    Returns null | Download

    The download or null if download doesn't exist.

  • Cancel a download and remove it from the download manager. Download will be stopped if it was running, and it will no longer be accessible through the download manager. If there is a downloaded file, partial or complete, it is deleted.

    Parameters

    • id: number

      The ID of the download.

    Returns boolean

    true if the download was deleted, or false otherwise.