I'm following the sample code given by Google to integrate Google plus with android.
https://github.com/googlesamples/google-services/blob/master/android/signin/app/src/main/java/com/google/samples/quickstart/signin/SignInActivity.java
That code sample worked perfectly fine until I added some changes as follows.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestScopes(new Scope(Scopes.PLUS_LOGIN))
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
signinGoogleBtn = (SignInButton) findViewById(R.id.signingoogleBtn);
signinGoogleBtn.setSize(SignInButton.SIZE_STANDARD);
signinGoogleBtn.setScopes(gso.getScopeArray());
I added Google+ scopes to GoogleSignInOptions in order to customize the signin button. Then GoogleSignInResult and handleSignInResult always returns false.
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
handleSignInResult(result);
Could anyone please help me to fix this issue?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…