0

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);
1
  • (Uri.parse(path)) Well what is the value of path? Commented Oct 8, 2020 at 18:56

1 Answer 1

1

I think you miswrote this line

Uri uri = Uri.parse("ID");

It should be

Uri uri = Uri.parse(ID); // string ID
Sign up to request clarification or add additional context in comments.

1 Comment

or try to change https to http .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.