什么是 com.android.externalstorage?
What is com.android.externalstorage?
尽管这是一个简单的问题,但我无法在 google or Whosebug 上找到答案。
当我使用下面的代码时,我得到了这个结果//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);
你能帮我理解结果的各个部分吗?
Android 存储如何工作?
为了确保 Android 应用程序之间的安全性,Android 不允许您直接访问存储系统中的每个文件。他们有一个叫做 ContentProvider
.
的东西
把这个内容提供者想象成一个服务员,你的应用程序可以要求特定的file/folder(通过内容 Uri)。
Content Uri 将如下所示:content://[Authority]/[path]/[id]
只是 Content Uri 的一个示例。 com.android.externalstorage.documents
是权限示例(用于访问外部存储提供程序)。
因此,在您的情况下,您的 Uri 将使您能够访问外部存储中的播客目录。
通过使用 Uri,您可以轻松地在应用程序或服务提供商之间进行通信,而无需在每次请求或提供文件时都传递真实文件。只需传递一个轻量级的简单 Uri。
你的代码发生了什么?
如果您想知道代码中发生了什么,请尝试查看 Reference。
它说:
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.
我不确定你想要达到什么目的(如果可以请说明,以便我能提供帮助),但我希望我的回答包含足够的信息。
尽管这是一个简单的问题,但我无法在 google or Whosebug 上找到答案。
当我使用下面的代码时,我得到了这个结果//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);
你能帮我理解结果的各个部分吗?
Android 存储如何工作?
为了确保 Android 应用程序之间的安全性,Android 不允许您直接访问存储系统中的每个文件。他们有一个叫做 ContentProvider
.
把这个内容提供者想象成一个服务员,你的应用程序可以要求特定的file/folder(通过内容 Uri)。
Content Uri 将如下所示:content://[Authority]/[path]/[id]
只是 Content Uri 的一个示例。 com.android.externalstorage.documents
是权限示例(用于访问外部存储提供程序)。
因此,在您的情况下,您的 Uri 将使您能够访问外部存储中的播客目录。
通过使用 Uri,您可以轻松地在应用程序或服务提供商之间进行通信,而无需在每次请求或提供文件时都传递真实文件。只需传递一个轻量级的简单 Uri。
你的代码发生了什么?
如果您想知道代码中发生了什么,请尝试查看 Reference。
它说:
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.
我不确定你想要达到什么目的(如果可以请说明,以便我能提供帮助),但我希望我的回答包含足够的信息。