DownloadManager mgr = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
Uri downloadUri = Uri.parse(file_url);
DownloadManager.Request request = new DownloadManager.Request(downloadUri);
request.setAllowedNetworkTypes(
DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE)
.setTitle("")
.setDestinationInExternalPublicDir(Environment.DIRECTORY_PICTURES + "/MyApp", tsLong.toString() + ".jpg");
下载文件的路径在这里:
new File(Environment.DIRECTORY_PICTURES + "/MyApp")
我发现一旦应用程序被卸载,该文件夹也会被删除,如何保存?
非常感谢。