Skip to content

Instantly share code, notes, and snippets.

@adrianhall
Created September 18, 2018 17:24
Show Gist options
  • Save adrianhall/1299476e99f94de277409b51cbb3ed7f to your computer and use it in GitHub Desktop.
Save adrianhall/1299476e99f94de277409b51cbb3ed7f to your computer and use it in GitHub Desktop.
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
GOOGLE_SIGN_IN -> {
val task = GoogleSignIn.getSignedInAccountFromIntent(data)
try {
val account = task.getResult(ApiException::class.java)
Log.d(TAG, "Authenticated with Google: token = ${account.idToken}")
model.federateWithGoogle(account)
[email protected]()
} catch (error: ApiException) {
toast("Google Authentication failed: ${error.message}")
}
}
else -> {
callbackManager.onActivityResult(requestCode, resultCode, data)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment