android-download-manager

how to save a downloaded file into internal storage in android?

爱⌒轻易说出口 提交于 2020-02-23 07:46:10
问题 i have used the below code to download a video from server in android studio and it works correctly , but when i search the video in my device i cant find it anywhere ... where does it save and how can i change destination directory on "internal storage"? private DownloadManager downloadManager; btn_download_video.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { downloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); Uri uri = Uri

DownloadManager notification displays no percentage

不想你离开。 提交于 2020-02-02 15:23:28
问题 I am trying to download files using the DownloadManager from API11+. So far file downloading has gone fine, but the action bar notification displays an undetermined size progress bar and query polling return no size until the file is completely downloaded. Code: DownloadManager.Request request = new DownloadManager.Request(Uri.parse(attachment.getUrl()) .setAllowedNetworkTypes( DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE) .setMimeType(attachment

Cancelling ongoing download does not remove notification

↘锁芯ラ 提交于 2020-01-15 03:30:11
问题 I am using Android DownloadManager, and have the ability to cancel ongoing download. This call also removes download progress from notification bar on all device I tested but from Nexus 5(running Android 5.0.1). Behavior is download is canceled but notification is not and get stuck at percentage complete when cancel was requested. Here is how I set request object to display notification DownloadManager.Request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); And this is

Download Manager not working

血红的双手。 提交于 2020-01-10 04:16:05
问题 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 IllegalStateException creating a download in DIRECTORY_DOWNLOADS

ε祈祈猫儿з 提交于 2020-01-09 10:07:34
问题 Firstly, there are a lot of questions on this subject, but none reflect my issue. I have for example read this and this. The issue that I have, is that in an extremely small number of cases, my function to setDestinationInExternalPublicDir results in the following stack trace: Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.onlinetvrecorder.otrapp2.listeners.DownloadUpdateReceiver: java.lang.IllegalStateException: Unable to create directory: /mnt/sdcard/Download at

DownloadManager IllegalStateException creating a download in DIRECTORY_DOWNLOADS

蓝咒 提交于 2020-01-09 10:07:06
问题 Firstly, there are a lot of questions on this subject, but none reflect my issue. I have for example read this and this. The issue that I have, is that in an extremely small number of cases, my function to setDestinationInExternalPublicDir results in the following stack trace: Fatal Exception: java.lang.RuntimeException: Unable to start receiver com.onlinetvrecorder.otrapp2.listeners.DownloadUpdateReceiver: java.lang.IllegalStateException: Unable to create directory: /mnt/sdcard/Download at

ContentObserver per row implementation

白昼怎懂夜的黑 提交于 2020-01-06 15:19:06
问题 After "observing" about ContentObserver I noticed that OnChange before API 16 not passing any parameters, so I decided to implement it to each row on my project (the project is downloading url's with the build-in DownloadManager) for each row I'm creating a new ContentObserver : Uri downloadsContentUri = Uri.parse("content://downloads/my_downloads/downloads/" + appDownloadId); DownloadsObserver downloadsObserver = new DownloadsObserver(downloadId, new Handler()); getContentResolver()

Download file with pause and resume button?

点点圈 提交于 2020-01-05 10:12:06
问题 I've googled much and I don't find my solution about two pause and resume button. I use from this code and this . But I don't know how implement pause and resume capability and set what to my pause and resume button onclick event: pausebtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { stopdownload(); AND resumedownload(); <------ } }); Thanks in advance. 回答1: To stop download call downloadTask.cancel(false); To support resuming download you can use

How to notify after all download completed from Android download manager

坚强是说给别人听的谎言 提交于 2020-01-04 07:46:08
问题 I'm using Android download manager class. I need to write "Download Complete" after all downloads are completed. I have tried something and it's working. But in here it's writing after file by file completed. I need to write only once (After all are completed). I also tried without a cursor. But I failed to achieve. public class DownloadReceiver extends BroadcastReceiver { Context context; @Override public void onReceive(Context context, Intent intent) { long receivedID = intent.getLongExtra(

DownloadManager.addCompletedDownload() deprecated on Android Q

限于喜欢 提交于 2020-01-03 11:33:57
问题 On upgrading recently to API 29, my code: downloadManager.addCompletedDownload(downloadFilename, downloadFilename, true, saveInfo.mimeType, downloadPath, outputFile.length(), true) …now produces a deprecation warning: Warning: 'addCompletedDownload(String!, String!, Boolean, String!, String!, Long, Boolean): Long' is deprecated. Deprecated in Java The API documentation for DownloadManager.addCompletedDownload says: This method was deprecated in API level 29. Apps should instead contribute