Я включил параметры загрузки файлов с помощью WebView. Я сохраняю файлы с помощью DownloadManager. Но файлы не появляются в локальном каталоге загрузок. Файлы, которые я скачал, сохраняются здесь.
> file/storage/emulated/0/Android/data/com.myapp/files/x.mp3
Я много пробовал. Но так или иначе это не было загружено в локальной папке загрузок. Что мне делать?
Мой код
String string = String.valueOf((URLUtil.guessFileName(url, contentDisposition, mimeType)));
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.setTitle("test17");
request.setDescription("Downloading file...");
request.setTitle(URLUtil.guessFileName(url, contentDisposition, mimeType));
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationInExternalFilesDir(getContext(), DIRECTORY_DOWNLOADS , string);
DownloadManager dm = (DownloadManager)getActivity().getSystemService(DOWNLOAD_SERVICE);
dm.enqueue(request);