Android-下载失败,但一切似乎正确

时间:2019-08-04 07:59:07

标签: android-download-manager

我一直在尝试修复下载管理器。每次下载都会失败。我正在从flask http服务器获取文件及其URL。

我尝试了一些网络教程,但没有帮助。 我尝试检查代码中的所有变量,如果一切正确。 然后,我尝试在浏览器中观看该视频(该视频具有应下载的地址),该视频可以完美显示。

2019-08-04 09:39:43.943 31461-31461/com.example.youtubedlapp I/System.out: URL RES{  "filename": "user_data/Rum/SABATON_-_Shiroyama_Official_Lyric_Video.mp4"}
2019-08-04 09:39:43.944 31461-31461/com.example.youtubedlapp I/System.out: URL RES 1: user_data/Rum/SABATON_-_Shiroyama_Official_Lyric_Video.mp4
2019-08-04 09:39:43.944 31461-31461/com.example.youtubedlapp I/System.out: URL RES 2: http://173.249.14.188:5000/open/Rum/SABATON_-_Shiroyama_Official_Lyric_Video.mp4
2019-08-04 09:39:43.944 31461-31461/com.example.youtubedlapp I/System.out: URL RES 3: SABATON_-_Shiroyama_Official_Lyric_Video.mp4

如您所见,我拥有所需的所有数据 下载代码:

                DownloadManager.Request request = new DownloadManager.Request(uriii);
                request.setTitle(fileName);
                request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI |
                        DownloadManager.Request.NETWORK_MOBILE);
                request.setDescription("Downloading");
                request.allowScanningByMediaScanner();
                request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
                request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName);
                request.setMimeType("*/*");


                downloadmanager.enqueue(request);

您可以在此图片上看到视频显示在网址中 https://imgur.com/a/SEHUoBL

所以我知道下载管理器可以下载所有内容

这是错误(不同的歌曲): https://imgur.com/a/F1B3D4r 预期的输出是应该下载文件。

0 个答案:

没有答案
相关问题