I have downloaded File
from my web service, the File
stored in
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS).getPath();
Then I use DownloadManager
to add this file to global Downloads
folder
DownloadManager dm = (DownloadManager) getContext().getSystemService(DOWNLOAD_SERVICE);
if (dm != null) {
dm.addCompletedDownload(
file.getName(),
file.getName(),
true,
MIME_TYPE_APPLICATION_PDF,
file.getAbsolutePath(),
file.length(),
true);
}
On some devices it work, on some devices the notification not shown and the file not added to Downloads
folder (the file successfully downloaded and exists).
NOTE: all devices < Android 10