1

I need help because when I Download a file on my WebView even I set the path to "/storage/17FA-1CEA/Favorite/" (17FA-1CEA is my sd card ) it always write on internal storage. Just like after I downloaded a file it writes on /storage/emulated/0/storage/17FA-1CEA/Favorite/file.mp3 instead writing it on sd card it creates a new folders.

Heres my code

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();

0 Answers0