Google Leaderbord ApiException
Asked Answered
J

1

6

My leaderboard doesn't work properly. I am able to show my leaderboard, but submitting score isn't working with the following code I tried to find out what is the problem, I get a APiException Message: 26502: CLIENT_RECONNECT_REQUIRED

mLeaderboardsClient = Games.getLeaderboardsClient(this, GoogleSignIn.getLastSignedInAccount(this));
    Task<ScoreSubmissionData> task = mLeaderboardsClient.submitScoreImmediate(getString(R.string.leaderboard_id), (long) 67);
    task.addOnFailureListener(new OnFailureListener() {
        @Override
        public void onFailure(@NonNull Exception e) {
            if(e instanceof ApiException) {
                writeText("dialog", "ApiException: " + e.getMessage());
            }else{
                writeText("dialog", "Exception: " + e.getMessage());
            }
            dialog.setVisibility(View.VISIBLE);
        }
    });

Unlocking Achievements is working as well as the Google sign in. I found nothing about this error message in the internet, so maybe someone has a idea what the problem could be. I tried different possibilities to sign in but nothing helped. I am trying to fix that for some days, so if you have a clue or just an idea what the problem could be write me. And if you need more code or answers feel free to ask.

Judiciary answered 17/1, 2018 at 23:13 Comment(4)
If you check the documentation, it states that The GoogleApiClient is in an inconsistent state and must reconnect to the service to resolve the issue. Further calls to the service using the current connection are unlikely to succeed.Wholesale
I think this should solve the problem: if(!mGoogleApiClient.isConnected()) { mGoogleApiClient.reconnect(); } but it doesn't, I get the same Exception. Am I wrong?Judiciary
Hi any one has answer for this question? Please post it if solved.Trudge
I have the same issue,Please find a solution, i am making a custom leaderboard,uninstalling and reinstalling the app sometimes solves the problem, is there any other leaderboard services available other than google play service, this issue is annoying me for two weeksBradney
S
0

You have to make sure that the client id you added in google play console is the same as the client id in google api console.

  1. Go to Google Play Console select game and select linked apps.
  2. Get OAuth2 Client ID at the bottom of the page.
  3. Click Game Details on the left menu. After that click link This game is linked to the API console project called 'link'
  4. Click credentials on new page
  5. Select OAuth 2.0 Client IDs
  6. Client ID at the right of the page should be same as you get at the step 2.

If these ids are different link your game with new app.

Shed answered 17/4, 2020 at 14:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.