【发布时间】:2017-01-30 21:22:20
【问题描述】:
我一直面临特定网址的这个问题。每当我尝试使用 android 管理器下载文件时,都会出现下载失败错误。当我尝试使用其他下载管理器说 ES File Downloader 的相同链接时,它运行良好。
这是我从 URI 下载的代码。
try{
uri = Uri.parse(urls.get(countLinks));
}catch(Exception e)
{
Log.d("Caught inside uri", e.toString());
}
这里还有下载管理器
Toast.makeText(getApplicationContext(), "Download Started", Toast.LENGTH_SHORT).show();;
DownloadManager.Request songDownload = new DownloadManager.Request(uri);
songDownload.setTitle(title);
songDownload.setDescription("Simple Mp3 Downloader...");
songDownload.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
songDownload.setDestinationInExternalPublicDir(Environment.DIRECTORY_MUSIC, (title+".mp3") );
songDownload.allowScanningByMediaScanner();
DownloadManager dm = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
dm.enqueue(songDownload);
在此过程中logcat中没有显示错误。但是下载管理器显示不成功。 :Here is a sample link
【问题讨论】: