I write a file to Environment.DIRECTORY_DOWNLOADS, why can't I see it via the Downloads App?

Viewed 23157

I write (write, not download, to be precise it is the dump of a SQLite db of my App) a file on the Environment.DIRECTORY_DOWNLOADS directory.

File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
File file = new File(path, "db.csv");

If I browse the phone with a file browser, I can see correctly the file in the

  /storage/emulated/0/Download

Directory, together with the other downloads.

But if I open the Downloads App it does not show...

What do I need to do to have the file shown in the Downloads App as well?

6 Answers

If you use setDestinationInExternalFilesDir(context, Environment.DIRECTORY_DOWNLOADS, fileName), look for a file in /sdcard/Android/data/<package name>/files/Download. In emulator it can be found in Device File Explorer.

enter image description here

If you use setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName), then you can find a downloaded file in Download folder of Files application.

enter image description here

Related