与下载管理器一起使用公共下载文件夹

发布于 2025-01-24 11:04:57 字数 729 浏览 2 评论 0原文

我正在尝试从firebase下载一些文件,所以我创建了此methode

private void downloadFile(String url, String destination,String fileName,String fileExtension)
{
    DownloadManager downloadManager = (DownloadManager) context.getSystemService(context.DOWNLOAD_SERVICE);
    Uri uri = Uri.parse(url);
    DownloadManager.Request request = new DownloadManager.Request(uri);
    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
    request.setDestinationInExternalFilesDir(context,destination,fileName+"."+fileExtension);
    downloadManager.enqueue(request);
}

,但是这些文件并未保存在公共下载文件夹中,它保存在android/data/apppackageName/apppackagename/files/files/storage/emulation/emulation/0/下载

i'm trying to download some files from firebase so i created this methode

private void downloadFile(String url, String destination,String fileName,String fileExtension)
{
    DownloadManager downloadManager = (DownloadManager) context.getSystemService(context.DOWNLOAD_SERVICE);
    Uri uri = Uri.parse(url);
    DownloadManager.Request request = new DownloadManager.Request(uri);
    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
    request.setDestinationInExternalFilesDir(context,destination,fileName+"."+fileExtension);
    downloadManager.enqueue(request);
}

but the files isn't saved in the public download folder it saved in Android/data/appPackageName/files/storage/emulated/0/Download

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文