Skip to content

Instantly share code, notes, and snippets.

@ianbarber
Created July 8, 2016 22:13
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 ianbarber/f3e4713d45adfd3611a5cec7bc810a79 to your computer and use it in GitHub Desktop.
Save ianbarber/f3e4713d45adfd3611a5cec7bc810a79 to your computer and use it in GitHub Desktop.
if (opr.isDone()) {
// If the user's cached credentials are valid, the OptionalPendingResult will be "done"
// and the GoogleSignInResult will be available instantly. We can try and retrieve an
// authentication code.
GoogleSignInResult result = opr.get();
handleSignInResult(result);
} else {
// If the user has not previously signed in on this device or the sign-in has expired,
// this asynchronous branch will attempt to sign in the user silently.
opr.setResultCallback(new ResultCallback<GoogleSignInResult>() {
@Override
public void onResult(@NonNull GoogleSignInResult googleSignInResult) {
handleSignInResult(googleSignInResult);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment