Last active
September 18, 2018 20:09
-
-
Save adrianhall/fd74f1d5b3e0d733b7879546e533fdc9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check to see if Google is authenticated - if it is, then federate with Google | |
val googleAccount = GoogleSignIn.getLastSignedInAccount(context) | |
if (googleAccount != null) { | |
Log.d(TAG, "Google Signed In Account found - account=${googleAccount.toJson()} ") | |
thread(start = true) { | |
try { | |
val googleOptions = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) | |
.requestIdToken(context.getString(R.string.google_client)) | |
.requestEmail() | |
.build() | |
GoogleSignIn.getClient(context, googleOptions).silentSignIn().continueWith { | |
val account = it.getResult(ApiException::class.java) | |
federateWithGoogle(account) | |
} | |
} catch (error: ApiException) { | |
// Silent ignore | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment