Google Drive + ACTION_GET_CONTENT [英] Google Drive + ACTION_GET_CONTENT
问题描述
看来Google云端硬盘有一个响应GET_CONTENT动作的活动,但它并未被导出。
是否有另一种方法可以在我的应用程序中使用将内容从云端硬盘中提取出来,而无需从云端硬盘启动进程?自己编写选取器/选择器活动并使用后端API列出并打开文件显然是一种选择,但我更愿意使用Drive自己的UI来执行此操作。
Storage Access Framework的全部重点在于它提供了一个单一的UI使用 startActivity
与 GET_CONTENT
, OPEN_DOCUMENT
或 OPEN_DOCUMENT_TREE
意图),用户可以从中选择任何源,包括本地存储,Google云端硬盘或任何其他应用。然后,您的应用程序可以使用完全相同的代码访问选定的文件。
没有功能允许您指定只有一个根(例如Google Drive)应该会出现。用户将始终可以从任何可用的根目录中进行选择。
It appears that Google Drive has an activity that responds to the GET_CONTENT action, but that it's not exported.
Is there another method that I can use in my app to pull content out of Drive, without having to initiate the process from Drive? Writing a picker/chooser activity myself and using the backend APIs to list and open a file is obviously an option, but I'd much rather use Drive's own UI to do that.
Google Drive only has an activity that supports GET_CONTENT
to support pre-API 19 devices. As per the Storage Access Framework guide, the GET_CONTENT
activity must be disabled on API 19+ devices to prevent a duplicate with the DocumentsProvider.
The whole point of the Storage Access Framework is that it provides a single UI (started when you use startActivity
with a GET_CONTENT
, OPEN_DOCUMENT
, or OPEN_DOCUMENT_TREE
Intent) that allows users to pick from any source, including local storage, Google Drive, or any other app. And your app can then access the selected file(s) using the exact same code.
There is no functionality that allows you to specify that only a single root (such as Google Drive) should appear. Users will always be able to select from any available root.
这篇关于Google Drive + ACTION_GET_CONTENT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!