Android 11 - 访问Android/data目录

标签 android

除了 root 之外,还有什么方法可以访问 Android 11 上的 SD 卡的 android/data 目录吗?我的(非 Play 商店)应用需要访问另一个应用的公共(public) Android/data/com.appname 文件夹。

最佳答案

你不能

On Android 11, apps can no longer access files in any other app's dedicated, app-specific directory within external storage.

即使使用MANAGE_EXTERNAL_STORAGE也无济于事

Apps that are granted this permission still cannot access the app-specific directories that belong to other apps because these directories appear as subdirectories of Android/data/ on a storage volume.

除非其他应用程序将这些文件设置为可共享

To allow other apps to access files stored in this directory within internal storage, use a FileProvider with the FLAG_GRANT_READ_URI_PERMISSION attribute.

了解更多Sharing files

关于Android 11 - 访问Android/data目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63887526/

相关文章:

Android编辑文本光标位置不会在第一次改变

java - Android服务停止,内存和以前一样

java - 如何使用自定义布局中的列表和复选框简化我的对话框代码?

Android Studio 找不到我导入的任何本地模块

android - setOutputFormat 和 setAudioEncoder 之间有什么关系吗

android - 如何从其他音乐播放器上当前播放的轨道中获取歌曲持续时间

棋盘的 Android 布局层次结构

android - 从图库中读取位图并将其写入 SD 卡失败

android - 有没有办法获取 Activity 中所有当前 Activity fragment 的引用?

java - 安卓长触事件