android-download-manager

Android DownloadManager get filename

主宰稳场 提交于 2019-12-17 18:17:14
问题 In my app you can download some files. I used the Android DownloadManager class for downloading. After the download is completed, it should show me a message that the file was downloaded. The problem is, there could be 2,3 or 4 downloads at the same time. My BroadcastReceiver code looks like this: receiver_complete = new BroadcastReceiver(){ @Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(DownloadManager.ACTION_DOWNLOAD

How to download a file from a server and save it in specific folder in SD card in Android?

十年热恋 提交于 2019-12-17 07:13:41
问题 I have one requirement in my Android application. I need to download and save file in specific folder of SD card programmatically. I have developed source code, which is String DownloadUrl = "http://myexample.com/android/"; String fileName = "myclock_db.db"; DownloadDatabase(DownloadUrl,fileName); // and the method is public void DownloadDatabase(String DownloadUrl, String fileName) { try { File root = android.os.Environment.getExternalStorageDirectory(); File dir = new File(root

Android Download manager Can only download HTTP URIs:

余生颓废 提交于 2019-12-13 16:58:31
问题 Well I am trying to download file via download manager my url adress starts as: https://dl.dropbox.com... it is working fine on android 4.1.2 or others. but it gives error at android 2.3.3 and this log cat java.lang.IllegalArgumentException: Can only download HTTP URIs: https://dl.dropbox.com/s/jcy3ahcauj7gu... at android.app.DownloadManager$Request.(DownloadManager.java:440) 回答1: Update Nov. 2019: You shouldn't have this problem nowadays with minSdkVersion being at least API 19, the native

DownloadManager downloading files over 2.1 GB

一个人想着一个人 提交于 2019-12-13 11:53:19
问题 I am working on an app and one of the features I am working on is to download some binary files. Some of them are really big (more than several mega-bytes). Downloads are completing fine as long as the file size is less than 2 GB. I got stuck on a file that is 3.2GB in that I get progress updates (I am pooling the DownloadManager for progress updates), but when the download completes, the file is not present on the target file path. Interrogating the DownloadManager for that download id, I

Android: How to create a direct download link in android

江枫思渺然 提交于 2019-12-12 21:06:27
问题 Can anyone give me an idea on how to create a textview which has a link and when the user click it, the file from that link will be automatically downloaded by the device EDIT: here's the code were working on: String link = "http://www.exampleurl.com/"+pref.getString("fsfile" + count, null); link = link.replaceAll(" ", "%20"); fsfile.setText("Attached File"); fsfile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // starting new Async Task new

Offer foreground download to user with possible dialog

落爺英雄遲暮 提交于 2019-12-12 18:06:11
问题 I'm fighting with usability design. Let's have application which has only one permission, android.permission.INTERNET . I want to download image from remote URL (where I cannot control server-side), but download it so user can choose whether and where download that file. Displaying dialog for process approval and/or choosing final destination. I have considered these solutions: DownloadManager using setDestinationInExternalPublicDir Two bugs, I don't want to add WRITE_EXTERNAL_STORAGE

Check if Download Manager downloaded the file

↘锁芯ラ 提交于 2019-12-12 16:08:32
问题 How can I check if file has been downloaded and run its installation? I have a code: public void downloadUpdate(String url){ DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); request.setDescription("Downloading..."); request.setTitle("App Update"); request.allowScanningByMediaScanner(); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); String name = URLUtil.guessFileName(url, null, MimeTypeMap.getFileExtensionFromUrl

Is there Pause action For Download Manager in Android?

半世苍凉 提交于 2019-12-12 10:39:44
问题 I'm using download manager class in android to download some files . This class can add and remove a request of downloading . Is there any way to pause a specific download then resume it ? Or Is there another way to do that ? Edit: I found this way, It's working: When pause downloading process, close the file we wrote on. When resume downloading, access to the file (not completed) and get its size Add downloaded bytes info to the header of httpRequest : mHttpRequset.setHeader("Range", "bytes=

Download manager does not work on LG devices

[亡魂溺海] 提交于 2019-12-12 10:38:27
问题 I try to perform downloading the file using DownloadManager. Everything works fine except LG devices. Here is my code: private void downloadFile(FileInfo fileInfo) { private DownloadManager manager = (DownloadManager) MyApp.getSingleton(). getApplicationContext().getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager.Request request = new DownloadManager.Request(Uri.parse("https://" + MyPreference.getInstance().getBaseUrl() + "/api/v3/files/" + fileId + "/get")); request.setDescription

How to pause using DownloadManager?

安稳与你 提交于 2019-12-12 10:31:01
问题 I want to achieve that when downloading, it can be paused, stopped by user. How can I achieve this with DownloadManager? 回答1: You can remove a download from the queue. Then you can start it up again, passing the Range HTTP Header when re-adding it to the queue (like TryTryAgain mentioned). I don't believe this currently can be done more easily. 回答2: It may be that "pausing" isn't exactly necessary for you? As DownloadManager actually doesn't need to pause to be resumed. Instead you may be