Android 11 和文件 API 支持
以下文章提到 Android 11 允许使用 File
API(在标题使用直接文件路径和本机库访问文件
下)。
https://developer.android.com/about/versions/11/privacy/存储
我想了解更多有关此的信息。这是指MANAGE_EXTERNAL_STORAGE
权限还是笼统地说。如果它并不意味着 MANAGE_EXTERNAL_STORAGE
权限,那么它究竟意味着什么?
- 如果我使用存储访问框架来保留路径。持久化后,我可以使用
File
类在该持久路径中使用File
类创建和保存文件吗?例如:
File file = new File(filePath);
FileOutputStream os = new FileOutputStream(file, false);
OutputStreamWriter out = new OutputStreamWriter(os);
out.write(downloadedSubtitles);
out.close();
- 我可以使用
File
类读取持久路径中的文件吗? - 我可以使用
file://
路径吗?
我也有不同的相关问题。我可以使用 File
类和上面的代码将文件写入应用程序的文件夹吗?
谢谢。
The following article mentions that Android 11 allows for usage of the File
API (under the title Access files using direct file paths and native libraries
).
https://developer.android.com/about/versions/11/privacy/storage
I would like more information on this. Does this refer to MANAGE_EXTERNAL_STORAGE
permission or does it speak in general. If it does not mean MANAGE_EXTERNAL_STORAGE
permission then what does it mean exactly?
- If I use Storage Access Framework to persist a path. After persistence, can I use the
File
class to create and save a file in that persistent path using theFile
class? For example:
File file = new File(filePath);
FileOutputStream os = new FileOutputStream(file, false);
OutputStreamWriter out = new OutputStreamWriter(os);
out.write(downloadedSubtitles);
out.close();
- Can I use the
File
class to read a file within the persisted path? - Can I use
file://
paths?
I also have different related question. Can I use the File
class with the code above to write files into the app's folder?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论