android - Intent.ACTION_OPEN_DOCUMENT 在 Android Q 中不起作用

标签 android android-10.0

我尝试附上一些照片(或其他!文档),这些照片是通过手机相机(或其他!应用程序 - 用于创建文档)制作的。如果我运行下面的代码来选择照片,我没有看到它们:

Screenshot from the App

如果我打开 android 文件资源管理器 - 照片存在:

Screenshot directly from android file explorer

其他文件夹的情况与最近的情况相同,请参阅附件屏幕:

Screenshot from the App 2

Screenshot directly from android file explorer 2

看起来我没有足够的权限 - 但我还需要什么权限才能使用 Android Q??

如果我使用 6.0 到 9.0 之后的任何其他 Android 版本 - 那么一切都很好!我可以浏览并选择我想要的所有文件。

Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
intent.setType("*/*");
startActivityForResult(intent,requestCode);

附注 DCIM\Camera 文件夹请看附件截图:

Screenshot directly from android file explorer 3

Screenshot directly from android file explorer 4

最佳答案

你试过 ACTION_GET_CONTENT

关于android - Intent.ACTION_OPEN_DOCUMENT 在 Android Q 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58282103/

相关文章:

android - "chain to a superclass"是什么意思?

安卓工作室 logcat : How to make it multiline instead of horizontal expansion

android - 如何在 android 达到限制时禁用复选框?

android - 全屏 Intent 不启动 Activity,但在 Android 10 上显示通知

Android 10. 媒体商店。获取所有图像

android - 蓝牙创建套接字错误

android-10.0 - ng serve 在使用 copy-webpack-plugin (Android OS/termux) 处理附加 Assets 时永远卡在 92%

java - 如何为应用内开发工具模拟 NFC 标签?

android - 无法从 Android Q 中的 Uri 加载视频缩略图

android - Google Play Services如何弹出Enable Bluetooth提示?