java – Eclipse Sign-In for Android not starting login activity

Question:

When launching the application in Eclipse, the GoogleSignInClient is initialized:

    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
                .requestEmail()
                .build(); 
mGoogleSignInClient = GoogleSignIn.getClient(this, gso); 

further in the button click handler I try to connect

Intent signInIntent = mGoogleSignInClient.getSignInIntent(); 

startActivityForResult(signInIntent, RC_SIGN_IN); 

At first, it swore that no activity was declared in the manifest. He added, as he asked in the manifest, the activity that he was missing, with the following name:

android: name = "com.google.android.gms.auth.api.signin.internal.SignInHubActivity"

Now, after pressing the button, nothing happens at all.

Answer:

Override the onActivityResult method and add the following code:

if (requestCode == RC_SIGN_IN) {
  Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
  handleSignInResult(task);
  return;
}
Scroll to Top
AllEscort