我正在使用下载管理器 我想使用我自己的 webview 下载一些音频文件。
我使用以下代码:
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url2));
request.setDescription("Downloading");
request.setTitle("File :");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
}
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "audio.mp3");
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
manager.enqueue(request);
即使文件名为 audio.mp3,下载管理器也无法识别文件类型。 屏幕截图解释了主要问题。
使用默认浏览器等其他应用程序下载的文件如下所示!
最佳答案
关于android - 下载管理器无法识别 .mp3 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25209174/