Android: download file from internet using DownloadManager and save it to the internal memory

走远了吗. 提交于 2019-12-22 09:05:43

问题


I am downloading a file from the web to my Android device using DownloadManager. I am saving this file on the sdcard using:

DownloadManager.Request req = new DownloadManager.Request(Uri.parse("file path"));
req.setTitle("file title").setDescription("Downloading ....") // download the package at the /sdcard/download path.
.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "file name"+ "file extension");

I want to save it to the internal storage. How to do that?


回答1:


use this path .setDestinationInExternalPublicDir(Environment.getExternalStorageDirectory() +"/Android/data/xxx.xxx.xxx/files/")



来源:https://stackoverflow.com/questions/11340853/android-download-file-from-internet-using-downloadmanager-and-save-it-to-the-in

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