When i'm trying to run the following code on my nexus 5 it shows a progress bar and actually download the file.
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setDescription("");
request.setTitle("");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
}
DownloadManager manager = (DownloadManager) getSystemService(Environment.DIRECTORY_MUSIC);
manager.enqueue(request);
}
but when i try the same thing on a lg g2 or lg g3 the file doesn't even start download and i get this message right after the beginning.
I think the problem is that lg phones have a different music dir and Environment.DIRECTORY_MUSIC
gives me an empty dir. If that is the problem does anyone know a way to get a correct dir for all devices? and if not does anyone have a clue what is the problem and how do i get it fixed?