1. Download our Official Android App: Forums for Android!

Apps Infinite Loop in Google Login

Discussion in 'Android Development' started by Wollo77, Jul 17, 2017.

  1. Wollo77

    Wollo77 Lurker
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    3
    Joined:
    Jul 17, 2017

    Jul 17, 2017
    3
    0
    15
    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 (Text):
    1. GoogleSignInOptions googleSignInOptions = googleSignInOptionsBuilder
    2.        .build();
    3.  
    4. googleApiClient = new GoogleApiClient.Builder(this)
    5.        .enableAutoManage(this,
    6.                new GoogleApiClient.OnConnectionFailedListener() {
    7.                    @Override
    8.                    public void onConnectionFailed(
    9.                            @NonNull ConnectionResult connectionResult) {
    10.                        Logger.error("Google API connection failed");
    11.                    }
    12.                })
    13.        .addApi(Auth.GOOGLE_SIGN_IN_API, googleSignInOptions)
    14.        .addApi(Games.API)
    15.        .build();
    Actual Sign-In method:
    Code (Text):
    1. public void signInWithGoogle() {
    2.    logToServer("Google Sign-In Started");
    3.    Intent signInIntent = Auth.GoogleSignInApi
    4.            .getSignInIntent(googleApiClient);
    5.    startActivityForResult(signInIntent,
    6.            GameConstants.GOOGLE_REQUEST_CODE_SIGN_IN);
    7. }
    Callback (never touched)
    Code (Text):
    1. @Override
    2. protected void onActivityResult(final int requestCode, int response,
    3.        Intent data) {
    4.    super.onActivityResult(requestCode, response, data);
    5.  
    6.    if (requestCode == GameConstants.GOOGLE_REQUEST_CODE_SIGN_IN) {
    7.        GoogleSignInResult result = Auth.GoogleSignInApi
    8.                .getSignInResultFromIntent(data);
    9.        handleGoogleSignInResult(result);
    10.    }
    11. }
     

    Advertisement

  2. LV426

    LV426 Illegitimi non carborundum
    Moderator
    Rank:
     #21
    Points:
    1,238
    Posts:
    4,824
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    4,824
    6,299
    1,238
    Male
    Software developer
    South West of England
  3. LV426

    LV426 Illegitimi non carborundum
    Moderator
    Rank:
     #21
    Points:
    1,238
    Posts:
    4,824
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    4,824
    6,299
    1,238
    Male
    Software developer
    South West of England
  4. LV426

    LV426 Illegitimi non carborundum
    Moderator
    Rank:
     #21
    Points:
    1,238
    Posts:
    4,824
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    4,824
    6,299
    1,238
    Male
    Software developer
    South West of England
    Another thing to check is the error log. Anything unusual reported there?
     
  5. Wollo77

    Wollo77 Lurker
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    3
    Joined:
    Jul 17, 2017

    Jul 17, 2017
    3
    0
    15
  6. Wollo77

    Wollo77 Lurker
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    3
    Joined:
    Jul 17, 2017

    Jul 17, 2017
    3
    0
    15
    I checked, but it's not giving any errors. I have not checked for debug output from outside the app (i.e. google play services), that may be worth a try.
     
  7. LV426

    LV426 Illegitimi non carborundum
    Moderator
    Rank:
     #21
    Points:
    1,238
    Posts:
    4,824
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    4,824
    6,299
    1,238
    Male
    Software developer
    South West of England
    Lol! That'll teach me to read questions properly.

    Another avenue to explore would be to trace the Google login Activity. Code should be available to set breakpoints in, and try to figure out what it's doing.
     

Share This Page

Loading...