安卓 11

问题描述

我想将图像、视频、音频和所有类型的文档(如 jpg、mp4、gif、txt、pdf、CSV 等)存储在一个文件夹中,如“ABC”,并将所有这些存储在(“ABC” ") 文件夹。

我有很多 R&D 并且在所有文件访问(MANAGE_EXTERNAL_STORAGE)权限下完成并且像我上面所说的那样完美地工作,但是由于所有文件访问权限,Play商店被拒绝。

Play 商店拒绝消息 策略:“访问所有文件”权限

File and directory attributes on your device are considered your personal and sensitive information and are subject to your personal and sensitive information policies and the following requirements:

The access that your app requests should be limited to device storage,which is essential for your app to function. You cannot request access to device storage for third parties for purposes unrelated to essential app features for your users.
Android devices running Android R (Android 11) or later require MANAGE_EXTERNAL_STORAGE permission to manage access in shared storage. Any app that targets R or later and requests a wide range of access to shared storage (“access to all files”) must pass a proper access review before it can be published. Apps that are allowed to use this permission must clearly display a message to the user asking them to enable Access to all files in the Special App Access settings. For more information on this requirement for R,see this help article.

Find out more about the Access All Files permission
Find out Android storage use cases and recommended methods
Please resolve this issue in Google Play Console.
.
Problem: I need to use the Media Store API

The "Access All Files" permission has been requested,but only media files need access for important features of the app. The MediaStore API allows apps to access and interact with media on external storage volumes without the need for "access to all files."

Update your app to use the Media Store API and remove the "Access All Files" (MANAGE_EXTERNAL_STORAGE) permission.

所以请帮助我了解使用 Scoped Storage 是如何工作的,例如在存储上创建一个文件夹,如 /data/ABC 并存储我提到的所有文档(jpg、mp4、gif、txt、pdf、CSV 等。 )

我想点赞请查看以下步骤

如果你使用它,请帮助我完成编码级别,因为我有很多研发但没有得到任何文档所以请不要分享任何文档所以如果你使用过请帮助我因为在 29 个 API 级别之前它正在工作29 API 级别我在清单上设置了 android:requestLegacyExternalStorage="true",所以我也为我工作,但 android 11(30) 我们所做的请给我一个适当的解决方案。

使用如下代码

最终字符串目录文件夹 = Environment.getExternalStorageDirectory() + "/" + "ABC";

    File file = new File(directoryFolder);
    if (!file.exists()) {
        file.mkdir();
    }

出现如下错误

com.androidnetworking.error.ANError: com.androidnetworking.error.ANError: java.io.FileNotFoundException: /storage/emulated/0/ABC/19429202106171621.pdf:打开失败:EPERM (不允许操作)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)