Reputation: 82
I have a link where if we go, the .mp4 file will be downloaded automatically, but if the try to do using the download manager then the files is saved as .html format which I want in .mp4.
String ID = "https://presaver.com/download/9Tw-f3i-08k/22";
DownloadManager downloadmanager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE);
Uri uri = Uri.parse("ID");
DownloadManager.Request request = new DownloadManager.Request(uri);
request.setTitle("YoutubeVideo");
request.setDescription("Downloading youtube video");
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setVisibleInDownloadsUi(true);
request.setDestinationUri(Uri.parse(path));
downloadmanager.enqueue(request);
Upvotes: 0
Views: 49
Reputation: 1529
I think you miswrote this line
Uri uri = Uri.parse("ID");
It should be
Uri uri = Uri.parse(ID); // string ID
Upvotes: 1