• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Infinite Loop in Google Login

Wollo77

Lurker
Jul 17, 2017
3
0
My app has been live using Google login for a few years now. I reworked the implementation a few months ago with no issues until recently. Now, a few weeks ago, login has stopped working. When I attempt it, the login never finishes, but stays in an infinite loop, displaying the "connecting" screen over and over.

  • internet connectivity is ok
  • this happens to many users (not sure if it affects ALL Google login users)
  • I have tried clearing the cache of Google Play services
  • the Google API client is still connected
  • I have tried updating all relevant google libraries to the most recent versions
  • I see this on Android 6 - not sure if other versions are affected
Before I post my code, I want to point out that the login never returns. The callback is never reached until I actively cancel the login (at which point it behaves as expected. I also want to emphasise again that my code has been in place for quite some time before this occurred - maybe something changed on Google side...

I'm out of ideas and in dire need of help. Any ideas?

API client creation in onCreate:
Code:
GoogleSignInOptions googleSignInOptions = googleSignInOptionsBuilder
       .build();

googleApiClient = new GoogleApiClient.Builder(this)
       .enableAutoManage(this,
               new GoogleApiClient.OnConnectionFailedListener() {
                   @Override
                   public void onConnectionFailed(
                           @NonNull ConnectionResult connectionResult) {
                       Logger.error("Google API connection failed");
                   }
               })
       .addApi(Auth.GOOGLE_SIGN_IN_API, googleSignInOptions)
       .addApi(Games.API)
       .build();
Actual Sign-In method:
Code:
public void signInWithGoogle() {
   logToServer("Google Sign-In Started");
   Intent signInIntent = Auth.GoogleSignInApi
           .getSignInIntent(googleApiClient);
   startActivityForResult(signInIntent,
           GameConstants.GOOGLE_REQUEST_CODE_SIGN_IN);
}
Callback (never touched)
Code:
@Override
protected void onActivityResult(final int requestCode, int response,
       Intent data) {
   super.onActivityResult(requestCode, response, data);

   if (requestCode == GameConstants.GOOGLE_REQUEST_CODE_SIGN_IN) {
       GoogleSignInResult result = Auth.GoogleSignInApi
               .getSignInResultFromIntent(data);
       handleGoogleSignInResult(result);
   }
}
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones