android-download-manager

Android DownloadManager remove() - how to determine when the remove() operation finishes?

好久不见. 提交于 2019-12-23 02:02:20
问题 Is there an easy mechanism to determine when a DownloadManager remove() has completed, as it appears to be partially asynchronous. The function returns almost instantaneously with a count of the entries in the Download table it's deleted, but the actual filesystem housekeeping appears to be pushed into some background thread. Issue is I've written a little bit of code that looks for and deletes any existing DownloadManager entry for file X (and hopefully the filesystem object), before pulling

Android can't open file

隐身守侯 提交于 2019-12-22 17:14:32
问题 I'm trying to download an apk file from server via DownloadManager: dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); request.setMimeType("application/vnd.android.package-archive"); request.allowScanningByMediaScanner(); enqueue = dm.enqueue(request); When the apk is downloaded and I press it I'm getting "can't open file message", But if I download that apk via Browser instead of DownloadManger : Intent

Why are wrong images getting loaded in ListView occasionally?

天大地大妈咪最大 提交于 2019-12-21 20:46:44
问题 I have a listview which loads images in every cell in async. When I try to scroll down slowly(after all the images in the current view are loaded), it works flawlessly. But when I try to scroll down before they are even loaded and scroll up, I face this issue. The cells start to show up images which don't correspond to them. My getView method looks like this: public View getView(final int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub View rowView = null;

Check if downloads are active

試著忘記壹切 提交于 2019-12-19 10:34:09
问题 So I'm using Download Manager to download multiple files in my app. I need these files to finish downloading before starting a certain activity. How can I check if there are active downloads, so I can tell the user to wait until the downloads are finished. And then, when they are finished, I need to make a button visible. I've googled this, even tried some code myself(blindly) and nothing works. If somebody can nudge me in the right direction I'd be grateful. 回答1: Use query() to inquire about

How can I wait until DownloadManager is complete?

丶灬走出姿态 提交于 2019-12-19 10:22:59
问题 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

Android download queue using DownloadManger

北城以北 提交于 2019-12-19 03:59:29
问题 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

DownloadManager requests delayed on Android Pie

戏子无情 提交于 2019-12-19 02:01:05
问题 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 ,

Android N - Download Manager Notification Cancel Button

本小妞迷上赌 提交于 2019-12-18 17:34:32
问题 Android N has a new Cancel Button in the Download Manager Notification. I would like to excecute some code in my app to stop a progressbar when the user presses this button. If any, which method is called? Please also note that the Intent filter action DownloadManager.ACTION_NOTIFICATION_CLICKED is triggered only when the user clicks on the notification itself, not when he/she clicks of the Cancel button. if_downloadManager = new IntentFilter(); if_downloadManager.addAction(DownloadManager

Android N - Download Manager Notification Cancel Button

淺唱寂寞╮ 提交于 2019-12-18 17:34:00
问题 Android N has a new Cancel Button in the Download Manager Notification. I would like to excecute some code in my app to stop a progressbar when the user presses this button. If any, which method is called? Please also note that the Intent filter action DownloadManager.ACTION_NOTIFICATION_CLICKED is triggered only when the user clicks on the notification itself, not when he/she clicks of the Cancel button. if_downloadManager = new IntentFilter(); if_downloadManager.addAction(DownloadManager

How to download multiple files concurrently using intentservice in Android?

左心房为你撑大大i 提交于 2019-12-18 11:39:30
问题 I want to create a service similar to this one, (reference from Here), to download multiple files asynchronously in Android. public static class DownloadingService extends IntentService { public static String PROGRESS_UPDATE_ACTION = DownloadingService.class .getName() + ".newDownloadTask"; private ExecutorService mExec; private CompletionService<NoResultType> mEcs; private LocalBroadcastManager mBroadcastManager; private List<DownloadTask> mTasks; public DownloadingService() { super(