除了 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/