我需要帮助,因为当我在webview上下载一个文件时,我甚至将路径设置为“/storage/17fa-1cea/favorite/”(17fa-1cea是我的sd卡),它总是写在内部存储器上。就像我下载了一个文件后,它写在/storage/emulated/0/storage/17fa-1cea/favorite/file.mp3上,而不是写在sd卡上,它创建了一个新的文件夹。
这是我的密码
mimetype = ".mp3";
path = "/storage/17FA-1CEA/Favorite/";
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setMimeType(mimetype);
String cookies = CookieManager.getInstance().getCookie(url);
request.addRequestHeader("cookie", cookies);
request.addRequestHeader("User-Agent", userAgent);
request.setDescription("Downloading file...");
request.setTitle(URLUtil.guessFileName(url, contentDisposition, mimetype));
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationInExternalPublicDir(path, URLUtil.guessFileName(url, contentDisposition, mimetype));
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
dm.enqueue(request);
Toast.makeText(getApplicationContext(), "Downloading File", Toast.LENGTH_LONG).show();
暂无答案!
目前还没有任何答案,快来回答吧!