7

我的应用程序要求用户选择一个 Google Drive 文件夹,以便以后可以将文件保存到所选文件夹。

到目前为止,它使用的是 Google Drive Android API 的文件夹选择器 UI,但现在它已被弃用并关闭。迁移说明建议使用存储访问框架(又名 SAF)来替换以前可用的文件选择器 UI。

问题是当我尝试使用 ACTION_OPEN_DOCUMENT_TREE 操作来启动 SAF UI 时,Google Drive 没有出现。另一个 Stackoverflow 帖子建议SAF不支持选择 Google Drive 文件夹,这很奇怪,因为它是一个非常重要和基本的功能。

有什么方法可以为 Google Drive 实现文件夹选择器 UI,而无需自己从头开始构建它?

 val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
 intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
 startActivityForResult(intent, 3);
4

0 回答 0