Skip to content

Instantly share code, notes, and snippets.

@Xiryl
Created February 11, 2023 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xiryl/b716be9c707e7a0311de4c36675aec15 to your computer and use it in GitHub Desktop.
Save Xiryl/b716be9c707e7a0311de4c36675aec15 to your computer and use it in GitHub Desktop.
driveapimedium-github-3
GoogleSignIn.getLastSignedInAccount(context)?.let { googleAccount ->
// get credentials
val credential = GoogleAccountCredential.usingOAuth2(
context, listOf(DriveScopes.DRIVE, DriveScopes.DRIVE_FILE)
)
credential.selectedAccount = googleAccount.account!!
// get Drive Instance
val drive = Drive
.Builder(
AndroidHttp.newCompatibleTransport(),
JacksonFactory.getDefaultInstance(),
credential
)
.setApplicationName(context.getString(R.string.app_name))
.build()
}
@nano871022
Copy link

What is the Drive library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment