Skip to content

Instantly share code, notes, and snippets.

@Xiryl
Created February 11, 2023 10:58
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/b8dd0fb3e4aa3e1e84b76faf455ebed4 to your computer and use it in GitHub Desktop.
Save Xiryl/b8dd0fb3e4aa3e1e84b76faf455ebed4 to your computer and use it in GitHub Desktop.
driveapimedium-github-1
val startForResult = rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { result: ActivityResult ->
if (result.resultCode == Activity.RESULT_OK) {
val intent = result.data
if (result.data != null) {
val task: Task<GoogleSignInAccount> =
GoogleSignIn.getSignedInAccountFromIntent(intent)
/**
* handle [task] result
*/
} else {
Toast.makeText(ctx, "Google Login Error!", Toast.LENGTH_LONG).show()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment