什么是com.android.externalstorage? [英] What is com.android.externalstorage?

查看:182
本文介绍了什么是com.android.externalstorage?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管这是一个简单的问题,但我在 google stackoverflow .

Despite this being a simple question I cannot find the answer on google or stackoverflow.

当我使用以下代码时,我得到的结果是//com.android.externalstorage.documents/tree/primary:Podcasts

When I use the following code I get this result //com.android.externalstorage.documents/tree/primary:Podcasts

var intent = new Intent(Intent.ActionOpenDocumentTree);
intent.PutExtra("android.content.extra.SHOW_ADVANCED", true);
intent.PutExtra("android.content.extra.FANCY", true);
intent.PutExtra("android.content.extra.SHOW_FILESIZE", true);

您能帮助我理解我的结果的某些部分吗?

Can you help me understand the parts of my result?

推荐答案

Android存储如何工作?

为了确保Android应用之间的安全性,Android不允许您直接访问存储系统中的每个文件.他们有一个叫做 ContentProvider 的东西.

To ensure security between Android apps, Android didn't let you directly access every file within the storage system. They have something called ContentProvider.

像服务员这样的内容提供商,您的应用程序可以通过Content Uri请求某个文件/文件夹.

Think of this content provider like a waiter, that your apps can ask for a certain file/folder (through Content Uri).

Content Uri如下所示: content://[Authority]/[path]/[id] 只是Content Uri的一个示例. com.android.externalstorage.documents 是授权示例(用于访问外部存储提供程序).

Content Uri will look like this: content://[Authority]/[path]/[id] is just an example of Content Uri. com.android.externalstorage.documents is an example of authority (for access to External Storage providers).

因此,在您的情况下,您的Uri将使您可以访问外部存储中的Podcast目录.

So in your case, your Uri will gain you access to the directory of Podcasts in your External Storage.

有了Uri,您可以轻松地在应用程序或服务提供商之间进行通信,而不必每次询问或提供文件时都传递真实文件.只需传递一个轻量级的简单Uri.

By having Uri, you can communicate between apps or service provider easily without having to pass real file every time you ask or give one. Just pass a lightweight simple Uri.

您的代码中发生了什么?

如果您想知道代码中会发生什么,请尝试查看

If you're wondering what happens in your code, try to look at the Reference.

它说:

允许用户选择目录子树.调用时,系统将显示设备上安装的各种 DocumentsProvider 实例,让用户在它们之间进行导航.应用程序可以完全管理返回目录中的文档.

Allow the user to pick a directory subtree. When invoked, the system will display the various DocumentsProvider instances installed on the device, letting the user navigate through them. Apps can fully manage documents within the returned directory.

我不确定您要达到的目标(请澄清是否可以,以便我能提供帮助),但我希望我的回答中包含足够的信息.

I'm not sure what you're trying to achieve (please clarify if you can, so I can help out), but I hope my answer contains enough information.

这篇关于什么是com.android.externalstorage?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆