I have developed an mp3 downloader which downloads mp3 from a URL to android phone using DownloadManager. But the problem is that if you uninstall the app, the files previously downloaded will get removed from the folder. I would like to get alternate methods or libraries to download mp3 files (only mp3) from a URL to android device.
storage = Environment.DIRECTORY_MUSIC;
request = new DownloadManager.Request(Uri.parse(downloadUrl));
extension =".mp3";
request.setMimeType("audio/MP3");
request.setTitle(vMeta.getTitle());
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationInExternalPublicDir(storage, vMeta.getTitle() + extension);
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
manager.enqueue(request);
vMeta.getTitle() - returns the title of the mp3 file and ext contains ".mp3" .
The file is getting downloaded and it is working fine.
NOTE : I have also tried DownloadManager.Request