Android: How to Use Download Manager Class

Android: How to use download manager class?

Is it possible to use the android download manager class that i found here

Yes, though that is only available since Android API Level 9 (version 2.3). Here is a sample project demonstrating the use of DownloadManager.

Download Files Using download manager

Finally fixed this by just 2 lines

 request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);

Android DownloadManager class: getUriForDownloadedFile return wrong path

You know where the DownloadManager downloaded the file, as you were the one who told it where to download it. So, get rid of getUriForDownloadedFile(id) on Android 6.0 and older devices, and use Uri.fromFile() for the File that you told DownloadManager to download the file to.

Note that on Android 7.0+, you have to use a content Uri for this, once your targetSdkVersion reaches 24 or higher. Fortunately, the installer knows how to handle content schemes on Android 7.0 and higher.



Related Topics



Leave a reply



Submit