android-download-manager

Caused by: java.lang.IllegalStateException: Unable to create directory in Android 6.0 devices

天大地大妈咪最大 提交于 2019-12-01 18:34:46
问题 I have to store the download the image from the url using DownloadManager and store it into the sdcard with my own directory like "xyz". This is my code File img_directory = null; img_directory = new File(Environment.getExternalStorageDirectory() + "/xyz"); if (!img_directory.exists()) { img_directory.mkdirs(); DownloadManager mgr = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); Uri downloadUri = Uri.parse("my image url"); DownloadManager.Request request = new DownloadManager

How can I wait until DownloadManager is complete?

馋奶兔 提交于 2019-12-01 10:33:56
This is the code I'm currently using String iosjiUrl = "http://modapps.com/NotoCoji.ttf"; DownloadManager.Request request = new DownloadManager.Request(Uri.parse(iosjiUrl)); request.setDescription("Sscrition"); request.setTitle("Somle"); // in order for this if to run, you must use the android 3.2 to compile your app if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { request.allowScanningByMediaScanner(); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); } request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS,

Download Files Using download manager

南楼画角 提交于 2019-12-01 08:30:44
I am downloading files from server using DownloadManager class Here is what i am doing public void downloadPdf(String url, String sem, String title, String branch) { Uri Download_Uri = Uri.parse(url); DownloadManager.Request request = new DownloadManager.Request(Download_Uri); //Restrict the types of networks over which this download may proceed. request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE); //Set whether this download may proceed over a roaming connection. request.setAllowedOverRoaming(false); //Set the title of this download,

Download Manager not working

柔情痞子 提交于 2019-12-01 08:10:28
I'm trying to develop app that show videos and you can Download it i'm using Download Manager class but it didn't work, also it didn't give me any error :( this is my download manager code: public void downloadFileFromUrl(String url, String fileName) { String filePath=Environment.getExternalStorageDirectory() + File.separator + "BlueNet"; File folder = new File(filePath); if (!folder.exists()) { folder.mkdirs(); } try { Uri downloadUri = Uri.parse(url); DownloadManager.Request request = new DownloadManager.Request(downloadUri); request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK

Android download queue using DownloadManger

倾然丶 夕夏残阳落幕 提交于 2019-11-30 23:17:55
I'm using DownloadManager to download my files in android and its great since it handles everything (connectivity lost, retry, etc.) The problem is I want my file to be downloaded in queue one after another and as far as i know DownloadManager doesn't provide this functionality. So multiple call to DownloadManager.enqueue(...) results in concurrent download of all the files. How can i fix this? I can not just make a queue in my activity and send downloads to DownloadManger one by one since activity may be destroyed at any time! Also IntentService doesn't work here!! even though it handles

DownloadManager requests delayed on Android Pie

廉价感情. 提交于 2019-11-30 20:11:00
I have been using the DownloadManager APIs to handle downloads in one app for about 3 years. Recently I had some users on Android Pie complaining that sometimes downloads get stuck for several minutes before actually starting, thus compromising the UX: some of them had to reinstall the app to make them work correctly, some others had the issue fixed itself over time. Please note that I haven't set any special settings to the DownloadManager.Request instances (e.g. allowedNetworkTypes , setRequiresCharging , ...). My understanding of the problem is that requests get stuck in the pending or

Android: detect when app is installed

让人想犯罪 __ 提交于 2019-11-30 16:30:01
I am trying to download an Android app from a server using the DownloadManager class, install it and then detect when the installation is completed. I am using two receivers: one to detect the download process and the other to detect the install process. The first receiver works properly, but the second doesn't. What I am doing wrong? DownloadManager dm = (DownloadManager) DownloadApplicationActivity.this.getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager.Request req = new DownloadManager.Request(Uri.parse(MY_LINK)); req.setTitle(MY_TITLE) .setDescription("Downloading ....") //

Get file name from headers with DownloadManager in Android

回眸只為那壹抹淺笑 提交于 2019-11-30 15:12:42
问题 I'm using DownloadManager to download video files from a url. The problem is if I use the default folder to download the file I can not see the video in the galery. Also, If I try to use this method: request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, 'filename'); I need to know the file name before download which in this case, I don't . And also, I don't have the name of the file in the url. How can I do to get the file name from the headers and pass the name to the

Get file name from headers with DownloadManager in Android

故事扮演 提交于 2019-11-30 14:40:43
I'm using DownloadManager to download video files from a url. The problem is if I use the default folder to download the file I can not see the video in the galery. Also, If I try to use this method: request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, 'filename'); I need to know the file name before download which in this case, I don't . And also, I don't have the name of the file in the url. How can I do to get the file name from the headers and pass the name to the method setDestinationInExternalPublicDir ? Other alternatives? In case anyone want an implementation of

DownloadManager - understanding ERROR_HTTP_DATA_ERROR

≡放荡痞女 提交于 2019-11-30 11:23:34
My application depends heavily on android DownloadManager component to download files with approximate size of 3-10 mega bytes. when scaling up (to millions of downloads) the big picture is clear: ~50% of all downloads are failing due to ERROR_HTTP_DATA_ERROR . I'm getting this info from google analytics according to the documentation, this error code stands for: Value of COLUMN_REASON when an error receiving or processing data occurred at the HTTP level. I found this documentation not very informative. there are plenty of http errors out there. and what about network disconnection in the