android-download-manager

DownloadManager - understanding ERROR_HTTP_DATA_ERROR

人走茶凉 提交于 2019-12-12 07:14:42
问题 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

Download Manager Progress Not Visible in the Notification Area

会有一股神秘感。 提交于 2019-12-12 04:45:13
问题 I am downloading a file from url using Download Manager. And the file is downloaded successfully. The problem File is downloading silently, no notification in the notification area. The download manager showed notification (with progressbar) on my device running on android 6.0. After i have updated my device to android 7.0 the download manager doesn't show any notification on the notification area. Here is my code Uri uri = Uri.parse("file://" + destination); url = "http:....."; //Valid File

why get java.lang.IllegalStateException: Unable to create directory error?

吃可爱长大的小学妹 提交于 2019-12-12 04:36:47
问题 I use DownloadManager class to download a file in android and this is my code for download: Uri downloadUri = Uri.parse(urlString); DownloadManager.Request request = new DownloadManager.Request(downloadUri); request.setDescription(des).setTitle(titleAudio).setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED). setDestinationInExternalPublicDir( "/my file name/" , titleAudio + String.valueOf(colForUrl) + pasvand); long id = downloadManager.enqueue(request);

Unable to download files using download manager in emulator

随声附和 提交于 2019-12-12 03:02:34
问题 Android Studio 2.1.2, API 23 Error: java.lang.SecurityException: No permission to write to/storage/emulated/0/Download/aabd.pdf: Neither user 10059 nor current process has android.permission.WRITE_EXTERNAL_STORAGE. Code : File file = new File(Environment.getExternalStoragePublicDirectory (Environment.DIRECTORY_DOWNLOADS), nameOfFile); request.setDestinationInExternalPublicDir (Environment.DIRECTORY_DOWNLOADS, nameOfFile); request.setVisibleInDownloadsUi(true); myDownloadReference =

background service for multitask downloader stops when close app from “recent apps”

末鹿安然 提交于 2019-12-12 02:23:15
问题 I have a downloader app project and I'm using a Service class for managing download tasks and showing notifications like this : the problem: when I close app from recent apps by swiping , the Service will be stop. I cant use startForeground for notifications , because I have multiple notifications in one service . and I like notify.setAutoCancel(true) works fine. here is AndroidManifest.xml code : <service android:name=".Downloader" android:exported="false" android:enabled="true" android

Download a file through http basic authentication with Xamarin Android

点点圈 提交于 2019-12-11 16:09:57
问题 I am accessing to an Enterprise Intranet using a WebView, in a Xamarin Android app. I can see and navigate correctly through the intranet but I am not able to download the files available there. This is my code : private void MWebview_Download(object sender, DownloadEventArgs e) { var url = e.Url; // var s = url.Replace(" ", "%20"); DownloadManager.Request request = new DownloadManager.Request(Android.Net.Uri.Parse(url)); string credentials = "cristina.casas:Tst.30"; //just for try // pasar

Opening a file downloaded with DownloadManager

大憨熊 提交于 2019-12-11 11:59:01
问题 I'm trying to open a file downloaded using DownloadManager. I'm getting the local filename after download is finished. After that I suggest my user to open file (or decline). The method I use for opening file is: private void openFile(String fileName) { MimeTypeMap map = MimeTypeMap.getSingleton(); String ext = MimeTypeMap.getFileExtensionFromUrl((fileName)); String type = map.getMimeTypeFromExtension(ext); Intent install = new Intent(Intent.ACTION_VIEW); Log.d(TAG, "openFile Trying to open

Interaction between IntentService and Activity - Android

跟風遠走 提交于 2019-12-11 11:41:24
问题 In my application I am using an IntentService to download a file from a cloud. And showing the progress in NotificationManager . I need to show the status (Downloading/Completed or Failed) in the Activity which stared the IntentService too. My problem is once I closed the app and open it back, I want to get the status of downloading from IntentService . Which is the best way to do this? 回答1: You can let your Activity bind to your Service, by calling bindService() in your Activity. As per the

registerReceiver from IntentService doesn't hit BroadcastReceiver

白昼怎懂夜的黑 提交于 2019-12-11 08:00:35
问题 I've created an IntentService for downloading a file using Android's DownloadManager. Following is my Class: public class DownloadService extends IntentService { public DownloadService() { super("name"); } BroadcastReceiver onComplete = new BroadcastReceiver() { public void onReceive(Context ctxt, Intent intent) { function(); } }; @Override protected void onHandleIntent(Intent intent) { registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); Utility.download

Best way to download images on Android

爷,独闯天下 提交于 2019-12-11 07:57:17
问题 I'm developing an Android application which uses several images and I would like transfer bigger images (2-6 MB) on a web server to download them when need. I've never tried it before so I've found a method which uses AsyncTask to download images on button click, is this the best solution? Any better options or opinions? EDIT: I'm trying koush's ion EDIT 2: I tried ion (https://github.com/koush/ion) and I like it here very well, very easy to use. advised 回答1: Use Universal image loader for