Code Implementation Google SignIn

suggest change
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
       .requestEmail()
       .build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
       .enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
       .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
       .build();
private void signIn() {
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);

   // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
   if (requestCode == RC_SIGN_IN) {
       GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
       handleSignInResult(result);
   }
}
private void handleSignInResult(GoogleSignInResult result) {
Log.d(TAG, "handleSignInResult:" + result.isSuccess());
if (result.isSuccess()) {
    // Signed in successfully, show authenticated UI.
    GoogleSignInAccount acct = result.getSignInAccount();
    mStatusTextView.setText(getString(R.string.signed_in_fmt, acct.getDisplayName()));
    updateUI(true);
} else {
    // Signed out, show unauthenticated UI.
    updateUI(false);
}
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents