在现有驱动器文件夹中创建 file/folder

Create file/folder in AN EXISTING drive folder

我在理解 Android 的所有 Google 驱动器 Api 时遇到了一些困难。

我只想知道,是否可以通过手动创建的现有文件夹中的 android 应用程序创建 file/folder。

我见过很多 GDAA 不允许 see/create/interact 的东西 files/folders 不是由 file.scope 或 device/application 的原因造成的26=] 对吗?

如果不使用 GDAA,我怎么能做到这一点?所有其他方法似乎已被弃用,我真的需要这个功能。

非常感谢,如果有错误,不流畅,请见谅。

Working with Folders 中所述,您可以:

  • 在根文件夹中创建一个文件夹

    为根文件夹调用DriveFolder.createFolder。传递包含标题和其他属性的元数据以设置文件夹的值。有关完整的工作示例,请参阅 CreateFolderActivity 示例。

  • 在文件夹中创建一个文件夹

    任何文件夹都可以用来在里面创建文件夹。首先,从 DriveId 中检索文件夹,然后调用 DriveFolder.createFolder。有关完整的工作示例,请参阅 CreateFolderInFolderActivity 示例。

  • 在文件夹中创建文件

    文件夹也可以使用 DriveFolder.createFile 在其中创建文件。此过程类似于 creating files in the root folder. You should pass the metadata and contents for the file to the create method. For a full working example, see the CreateFileInFolderActivity 示例。

要回答有关范围的问题,请使用 Drive, you need to enable the API and at least one scope of SCOPE_FILE or SCOPE_APPFOLDER in a GoogleApiClient. Additionally, it was noted in Connecting and Authorizing the Google Drive Android API 即:

The Google Drive Android API currently only supports drive.file and drive.appfolder authorization scopes. If your application requires additional permissions or features not yet available in the Drive Android API, you must use the Google APIs Java Client.

最后,对于 Google Drive Android API 中不可用的功能或特性,您可以选择使用 Google Drive REST API至 Work with Folders.

你也可以参考这个SO post - Creating a folder inside a folder in google drive android。希望对您有所帮助。