androidandroid-studiokotlinandroid-download-manager

Why don't we need storage permission to download a file through DownloadManager


I'm downloading a file through android DownloadManager with de function below.

 private fun downloadFile() {
        val downloadManager: DownloadManager =
            getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager

        val request =
            DownloadManager.Request(Uri.
            parse("https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"))

        downloadManager.enqueue(request)
    }
}

The download occurs normally without any storage permissions.

Does the download manager work without storage permissions? I can't find the answer in the official documentation.

https://developer.android.com/reference/android/app/DownloadManager


Solution

  • DownloadManager delegates the downloading work to a separate system-supplied app. That app has rights to write to a few locations, even if your app does not.