0

I am using the following code

                    DownloadManager downloadManager = (DownloadManager) context.getSystemService(DOWNLOAD_SERVICE);

                Uri downloadUri = Uri.parse(post.vUrl);
                DownloadManager.Request request = new DownloadManager.Request(downloadUri);

                request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, "My_APP."+post.date);
                request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
                request.setVisibleInDownloadsUi(true);
                request.setMimeType("video/mp4");
                downloadManager.enqueue(request);

i have tried it with and without

                    request.setMimeType("video/mp4");

It downloads the video and if I press on it in the menu (on the download arrow) it plays perfectly fine. However, if I close it and try to access it in my downloads folder, my phone tells me it cannot open this type of file.

I don't get why. It works when I click on the download but not later on? Any solutions?

Zash__
  • 293
  • 4
  • 16
  • You did not post the problematic code. – blackapps Jan 25 '21 at 23:28
  • Thats the code I am using and its not working – Zash__ Jan 26 '21 at 11:31
  • Well i dont see the problematic code for : `if I close it and try to access it in my downloads folder, my phone tells me it cannot open this type of file.` – blackapps Jan 26 '21 at 11:43
  • `Thats the code I am using and its not working` AND `don't get why. It works when I click on the download` do not match. – blackapps Jan 26 '21 at 11:44
  • No I guess you do not understand my issue: Let me clarify: When I press on the download in the top left of the command central (or whatever it is called in android) it opens the video and it works. Of course, the notification of the download disappears as I pressed it. When I want to watch the video again, I go into my downloads folder and then it cannot be started. It does not work when I open it from the downloads folder. – Zash__ Jan 26 '21 at 11:46
  • How are you going to your 'downloads' folder? Which app? Wasn't it the Movies folder? Please tell file size in bytes of original and your copy. – blackapps Jan 26 '21 at 11:48
  • `"My_APP."+post.date` We have no idea what filename that would be. Please give an example. – blackapps Jan 26 '21 at 11:49
  • `(or whatever it is called in android)` Well wasn't it a notification? – blackapps Jan 26 '21 at 11:50
  • On my Samsung its called "my data" and there I can see everything I downloaded from other apps. The video downloaded from my app show up as well but I cannot open it. It tells me I have no app for opening such a file. And yes its a notification. I press on it (the download icon) and it works. But after reopening it from my downloads file, it does not work – Zash__ Jan 26 '21 at 11:58
  • I have no idea what 'my data' would be. Cant you take a fille manager app like Files and go to the Movies directory and open your file there? And you did not give an example for the used filename. Strange.... Which apps did you try to let your file be played? – blackapps Jan 26 '21 at 12:07
  • My data is just files translated. Its the standard files folder. And I mentioned multiple times I cannot open it at all in the folder. It tells me to download an app to open it. I assume that you try to fix something else. What I want is that the downloaded file is saved as "video", not as a "file". hence the .setMimeType() which is not working. What does it have to do with the name? its just an arbitrary name. E.g: Flax.12184883. How dies it help? I can find the file easily but it won't open – Zash__ Jan 26 '21 at 12:51
  • Where do you see that the file is saved as 'file'? To start with the last: give the file name an extension like .mp4. `My data is just files translated. Its the standard files folder.` ? If you mean the Files app then that is an app and no folder. – blackapps Jan 26 '21 at 15:32
  • It does not show the video icon unlike it does when I download videos from other apps. And I cannot open it. – Zash__ Jan 26 '21 at 15:46

0 Answers0