2

Every time I attempt to access my leaderboards within my app, they close automatically. However, the achievements work flawlessly. I am getting error code 10001 (RESULT_RECONNECT_REQUIRED). From the Google Play website,

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.

However, reconnecting does not work.

Here is a list of solutions I found that did not work for me

  • Reinstalling the app
  • Deleting data from Google Play Games and Google Play Services
  • Checking the services are set up properly

The code I'm using to present the leaderboards is:

act.startActivityForResult(Games.Leaderboards.getAllLeaderboardsIntent(client), RC_SIGN_IN);
//act.startActivityForResult(Games.Leaderboards.getLeaderboardIntent(client, act.getString(R.string.leaderboard_progression)), RC_SIGN_IN); //Single leaderboard does not work either

Help would be greatly appreciated!

Update 1:

Tried using this in onActivityResult():

System.out.println(client.getConnectionResult(Games.API));

But it simply outputs this:

ConnectionResult{statusCode=SUCCESS, resolution=null, message=null}

On the Google API website, for my app, it shows me that there are a lot of 4xx errors. From http://www.websitepulse.com/kb/4xx_http_status_codes.html,

4xx - Client Error

This group of HTTP status codes indicates that the request for the resource contains bad syntax or cannot be filled for some other reason, presumably by fault of the client sending the request. Except when responding to a HEAD request, the server SHOULD include an explanation of the error situation and whether it is a temporary or permanent condition. These status codes are applicable to any request method.

So from this, I can assume that the issue is client-side. But I don't know what could be wrong. I checked my SHA1, app ID, etc., and the achievements work fine. I also tried updating my build.gradle's dependencies to the latest version of Play Services, but it did not fix anything.

Community
  • 1
  • 1
Jason Leddy
  • 111
  • 6

2 Answers2

1

So I finally figured it out... Though I previously tried clearing data from Play Games and Play Services without success, I tried it again, and it works. And I figured out why; originally I used:

Games.Leaderboards.submitScore(client, act.getString(id), SCORE);

to submit leaderboard scores. However, when trying to fix my leaderboards, I was using:

PendingResult r = Games.Leaderboards.submitScoreImmediate(client, act.getString(id), SCORE);
ResultCallback callback = new ResultCallback()
{
    @Override
    public void onResult(@NonNull Result result)
    {
        //System.out.println(result.getStatus());
        //System.out.println(result.getStatus().getStatusMessage());
        //System.out.println(result.getStatus().hasResolution());
    }
};
r.setResultCallback(callback);

And for some reason, this works. I've tried switching back and forth between my original method and the new method multiple times, clearing data between each test. The leaderboards only work with the new solution. I have no idea why, but I'm just glad it works.

Jason Leddy
  • 111
  • 6
0

Had problems with leaderboards too. This solution helped to solve my problem, thanks, but Games. Leaderboards, submitScoreImmediate is deprecated now.

Alternatively you can use :-

yourLeaderboardsClient.submitScoreImmediate(LEADERBOARD_ID, SCORE); 

Works as well and not deprecated. So if anyone encounter such problem - you can use such variant, hope it will help.

bharat
  • 1,762
  • 1
  • 24
  • 32
  • I'm using the newer APIs and I'm getting the same errors, just on some devices `com.google.android.gms.common.api.ApiException: 26502: CLIENT_RECONNECT_REQUIRED`, no idea why... Is there a solution? In the new API there is no reconnect option and this error is deprecated. What does that even mean? – Luan Nico Mar 17 '19 at 15:18
  • @LuanNico sorry, I have no idea why it happens if you implemented leaderboards properly. I suggest you to re-check your leaderboards logic according to official documentation - probably you are still using old API somehow. – Sergii Litvinenko Mar 18 '19 at 16:58