Skip to content

Instantly share code, notes, and snippets.

@Xiryl
Last active March 6, 2023 15:56
Show Gist options
  • Save Xiryl/2ab4f71c3d2a1c68e27311f0f78596f9 to your computer and use it in GitHub Desktop.
Save Xiryl/2ab4f71c3d2a1c68e27311f0f78596f9 to your computer and use it in GitHub Desktop.
driveapimedium-github-4
viewModelScope.launch(Dispatchers.IO) {
// Define a Folder
val gFolder = com.google.api.services.drive.model.File()
// Set file name and MIME
gFolder.name = "My Cool Folder Name"
gFolder.mimeType = "application/vnd.google-apps.folder"
// You can also specify where to create the new Google folder
// passing a parent Folder Id
val parents: MutableList<String> = ArrayList(1)
parents.add("your_parent_folder_id_here")
gFolder.parents = parents
drive.Files().create(gFolder).setFields("id").execute()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment