DownloadManager not storing Downloaded files in Download Folder

别来无恙 提交于 2019-12-04 08:19:24

To see the downloaded files, you must have File Manager app installed in your phone. Steps to view downloaded files:

  1. Open File Manager app.
  2. Go to storage -> sdcard
  3. Go to Android -> data -> "Your package name" eg. com.xyx.abc
  4. Here are all your downloads.

Path is: storage/sdcard/Android/data/"your package"

Use below methos to save files in Download folder

.setDestinationInExternalFilesDir(this, dir, "abc.png");

Try

request.setDestinationInExternalPublicDir("/folder","file.ext");

This will save the file to

Environment.getExternalStorageDirectory() + "/folder"

If you try to find where the DownloadManager stored the file using

String file = <Cursor>.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI)

you get a ficticious path: "context://downloads/my_downloads/{number}". To see the actual path, use:

String file = <Cursor>.getColumnIndex(DownloadManager.COLUMN_LOCAL_FILENAME)

You then get: "/data/user/0/com.android.providers.downloads/cache/{filename}" (or something similar) and you can access the file from there.

Steps to find your downloads and export them to local folders. Download Manager - > Top right there is a menu button - > files - > mark the item(s) - > export.

Hope it helped :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!