简体   繁体   English

READ_EXTERNAL_STORAGE 是否可以根据情况在 Android 11 中提供不同程度的访问权限?

[英]Is it possible for READ_EXTERNAL_STORAGE to give varying degrees of access, in Android 11 depending on the circumstance?

I have two apps, both do different things but both target sdk version 30, and request READ_EXTERNAL_STORAGE permission both in the manifest and during runtime.我有两个应用程序,它们都做不同的事情,但都针对 sdk 版本 30,并在清单和运行时请求 READ_EXTERNAL_STORAGE 权限。 Both are brand new and had not been installed on the device previously.两者都是全新的,之前没有安装在设备上。

Using a samsung phone running Android 11, I then checked the permission settings on both apps and discovered this discrepancy:使用运行 Android 11 的三星手机,然后我检查了两个应用程序的权限设置并发现了这种差异:

  • App #1 has its permission set to "allow access to media only," which was what I expected due to the recent changes to storage access. App #1 的权限设置为“仅允许访问媒体”,由于最近对存储访问的更改,这是我所期望的。 App #2 however, had its permission set to "Allow access to manage all files."但是,App #2 的权限设置为“允许访问管理所有文件”。
  • When App #1 prompts the user for read permission, the message that the system displays is "Allow ____ to access photos and media on your device?"当 App #1 提示用户读取权限时,系统显示的消息是“允许 ____ 访问您设备上的照片和媒体?” But App #2 prompts "Allow ____ to access photos, files , and media on your device?"但 App #2 会提示“允许 ____ 访问您设备上的照片、文件和媒体?”

Is this possible?这可能吗? App #2 definitely does not ever request MANAGE_EXTERNAL_STORAGE, both of them only request the read permission which does work.应用程序 #2 绝对不会请求 MANAGE_EXTERNAL_STORAGE,它们都只请求有效的读取权限。 But App #2 has the same permissions to the system file manager, that clearly can't be right.但是 App #2 对系统文件管理器具有相同的权限,这显然是不对的。

Could it be that App #2 uses a library that uses MANAGE_EXTERNAL_STORAGE?难道 App #2 使用了一个使用 MANAGE_EXTERNAL_STORAGE 的库? You could compare the AndroidManifest of both apps after they are build.您可以在构建后比较两个应用程序的 AndroidManifest。 They are not always the same as the AndroidManifest that you wrote yourself for the app.它们并不总是与您为应用程序编写的 AndroidManifest 相同。 Libraries can define their own required permissions and that will get merged into the final AndroidManifest库可以定义自己所需的权限,并将合并到最终的 AndroidManifest 中

Found the issue.发现问题。 App #2 was built using androiddeployqt which for some reason was overriding the target sdk version I specified, so it was really an sdk level 28 app.应用程序 #2 是使用 androiddeployqt 构建的,出于某种原因,它覆盖了我指定的目标 sdk 版本,因此它实际上是一个 sdk 级别 28 应用程序。 I forced it to target the correct version and it now functions as expected.我强迫它以正确的版本为目标,现在它按预期运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android READ_EXTERNAL_STORAGE 权限不起作用 - Android READ_EXTERNAL_STORAGE permission not working Android 的 READ_EXTERNAL_STORAGE 权限 - READ_EXTERNAL_STORAGE permission for Android 如何在 android 11 上使用没有 READ_EXTERNAL_STORAGE 的 File("/sdcard/myfile")? - How use File("/sdcard/myfile") without READ_EXTERNAL_STORAGE on android 11? 即使我在清单中声明,Read_external_storage 权限也不起作用,不在 android 工作室中运行 - Read_external_storage permission is not working even i have declared in manifest,not running in android studio 由于需要READ_EXTERNAL_STORAGE权限而崩溃,即使它在清单中 - Crash due to requiring READ_EXTERNAL_STORAGE permission even though it's in the Manifest READ_EXTERNAL_STORAGE权限,尽管清单中有此权限,但应用程序崩溃 - READ_EXTERNAL_STORAGE permission, app crash despite I have this in manifest 在Android上读写外部存储 - Read/write external storage on Android 如何在不使用 MANAGE_EXTERNAL_STORAGE 的情况下读取 Android 11 中的 my.xml 文件? - How can I read my .xml file in Android 11 without using MANAGE_EXTERNAL_STORAGE? 如何访问 android 11 中的内部存储? - How to take access to internal storage in android 11? 从外部存储Android中读取图像/文件 - Read an Image/file from External storage Android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM