微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

安卓 11

如何解决安卓 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 举报,一经查实,本站将立刻删除。