IT. Expert System.

Android Reference

DownloadManager.Request


android.app

Class DownloadManager.Request

  • Enclosing class:
    DownloadManager


    public static class DownloadManager.Request
    extends Object
    This class contains all the information necessary to request a new download. The URI is the only required parameter. Note that the default download destination is a shared volume where the system might delete your file if it needs to reclaim space for system use. If this is a problem, use a location on external storage (see setDestinationUri(Uri).
    • Constructor Detail

      • DownloadManager.Request

        public DownloadManager.Request(Uri uri)
        Parameters:
        uri - the HTTP URI to download.
    • Method Detail

      • setDestinationUri

        public DownloadManager.Request setDestinationUri(Uri uri)
        Set the local destination for the downloaded file. Must be a file URI to a path on external storage, and the calling application must have the WRITE_EXTERNAL_STORAGE permission.

        The downloaded file is not scanned by MediaScanner. But it can be made scannable by calling allowScanningByMediaScanner().

        By default, downloads are saved to a generated filename in the shared download cache and may be deleted by the system at any time to reclaim space.

        Returns:
        this object
      • setDestinationToSystemCache

        public DownloadManager.Request setDestinationToSystemCache()
        Set the local destination for the downloaded file to the system cache dir (/cache). This is only available to System apps with the permission android.Manifest.permission#ACCESS_CACHE_FILESYSTEM.

        The downloaded file is not scanned by MediaScanner. But it can be made scannable by calling allowScanningByMediaScanner().

        Files downloaded to /cache may be deleted by the system at any time to reclaim space.

        Returns:
        this object
      • allowScanningByMediaScanner

        public void allowScanningByMediaScanner()
        If the file to be downloaded is to be scanned by MediaScanner, this method should be called before DownloadManager.enqueue(Request) is called.
      • addRequestHeader

        public DownloadManager.Request addRequestHeader(String header,
                                               String value)
        Add an HTTP header to be included with the download request. The header will be added to the end of the list.
        Parameters:
        header - HTTP header name
        value - header value
        Returns:
        this object
        See Also:
        HTTP/1.1 Message Headers
      • setTitle

        public DownloadManager.Request setTitle(CharSequence title)
        Set the title of this download, to be displayed in notifications (if enabled). If no title is given, a default one will be assigned based on the download filename, once the download starts.
        Returns:
        this object
      • setDescription

        public DownloadManager.Request setDescription(CharSequence description)
        Set a description of this download, to be displayed in notifications (if enabled)
        Returns:
        this object
      • setShowRunningNotification

        @Deprecated
        public DownloadManager.Request setShowRunningNotification(boolean show)
        Control whether a system notification is posted by the download manager while this download is running. If enabled, the download manager posts notifications about downloads through the system NotificationManager. By default, a notification is shown. If set to false, this requires the permission android.permission.DOWNLOAD_WITHOUT_NOTIFICATION.
        Parameters:
        show - whether the download manager should show a notification for this download.
        Returns:
        this object
      • setNotificationVisibility

        public DownloadManager.Request setNotificationVisibility(int visibility)
        Control whether a system notification is posted by the download manager while this download is running or when it is completed. If enabled, the download manager posts notifications about downloads through the system NotificationManager. By default, a notification is shown only when the download is in progress.

        It can take the following values: VISIBILITY_HIDDEN, VISIBILITY_VISIBLE, VISIBILITY_VISIBLE_NOTIFY_COMPLETED.

        If set to VISIBILITY_HIDDEN, this requires the permission android.permission.DOWNLOAD_WITHOUT_NOTIFICATION.

        Parameters:
        visibility - the visibility setting value
        Returns:
        this object
      • setAllowedNetworkTypes

        public DownloadManager.Request setAllowedNetworkTypes(int flags)
        Restrict the types of networks over which this download may proceed. By default, all network types are allowed. Consider using setAllowedOverMetered(boolean) instead, since it's more flexible.
        Parameters:
        flags - any combination of the NETWORK_* bit flags.
        Returns:
        this object
      • setAllowedOverRoaming

        public DownloadManager.Request setAllowedOverRoaming(boolean allowed)
        Set whether this download may proceed over a roaming connection. By default, roaming is allowed.
        Parameters:
        allowed - whether to allow a roaming connection to be used
        Returns:
        this object
      • setVisibleInDownloadsUi

        public DownloadManager.Request setVisibleInDownloadsUi(boolean isVisible)
        Set whether this download should be displayed in the system's Downloads UI. True by default.
        Parameters:
        isVisible - whether to display this download in the Downloads UI
        Returns:
        this object


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 570 / . Delta: 0.00812 с