I am currently working on an application where you can upload video files. I use the download manager to download files, and everything works fine as the files are loading properly and I can see the download progress in my notifications. Now I want to show these file downloads in another class (containing recyclerview) with progress. So what should I do to implement this module?
Currently my download file code is:
public static long fileDownloader(Activity context, Video video) {
File direct = new File(Environment.getExternalStorageDirectory()
+ "/FWV Videos");
if (!direct.exists()) {
direct.mkdirs();
}
DownloadManager mgr = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
Uri downloadUri = Uri.parse(video.getVideoURL());
DownloadManager.Request request = new DownloadManager.Request(
downloadUri);
request.setAllowedNetworkTypes(
DownloadManager.Request.NETWORK_WIFI
| DownloadManager.Request.NETWORK_MOBILE)
.setAllowedOverRoaming(false).setTitle(video.getName())
.setDescription("Downloading file...")
.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
.setVisibleInDownloadsUi(false)
.setDestinationInExternalPublicDir("/FWV Videos", video.getName() + ".mp4")
.allowScanningByMediaScanner();
Toast.makeText(context, "Download started", Toast.LENGTH_SHORT).show();
return mgr.enqueue(request);
}
I just need a separate list where I can show current downloads and completed downloads
source
share