0

I'm implementing the Google Play Games Leaderboards in Unity and I'm making my UI for view the Leaderboard, for that, I'm using:

SDK: https://github.com/playgameservices/play-games-plugin-for-unity

Google Play Service version: 9.4.0

When I use LoadScores method from PlayGamesPlatform class It's all right, return the users, scores, etc, but, for get more users, I need to use LoadMoreScores method and here is the problem.

When I use LoadMoreScores method, In the log, Android return that and don't return more players:

E/Volley: [5566] BasicNetwork.performRequest: Unexpected response code 410 for https://www.googleapis.com/games/v1/leaderboards/LeaderboardID/window/PUBLIC?timeSpan=ALL_TIME&language=en_US&maxResults=10&pageToken=LeaderboardNextToken&returnTopIfAbsent=true
W/LeaderboardAgent: Failed to retrieve leaderboard scores for GameID LeaderboardID ALL_TIME
                                                     com.android.volley.ServerError
                                                         at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms:163)
                                                         at iss.performRequest(:com.google.android.gms:64)
                                                         at com.android.volley.NetworkDispatcher.run(:com.google.android.gms:113)
W/LeaderboardAgent: {"errors":[{"domain":"global","reason":"PaginationTokenInvalid","message":"The passed token does not match the arguments of the request. Token: LeaderboardNextToken"}],"code":410}

My code in Unity3D for this error is:

/// <summary>
/// Loads the scores using the provided parameters.
/// </summary>
/// <param name="leaderboardId">Leaderboard identifier.</param>
/// <param name="start">Start either top scores, or player centered.</param>
/// <param name="rowCount">Row count. the number of rows to return.</param>
/// <param name="collection">Collection. social or public</param>
/// <param name="timeSpan">Time span. daily, weekly, all-time</param>
/// <param name="callback">Callback to invoke when completed.</param>
PlayGamesPlatform.Instance.LoadScores(
            "LeaderboardID", //The original ID obviously
            LeaderboardStart.PlayerCentered,
            10,
            LeaderboardCollection.Public, 
            LeaderboardTimeSpan.AllTime,
            (success) =>
            {
                leaderboardScoreData = success;
                //Do Anything...
            }
);

And in a button after LoadScores...

/// <summary>
/// Loads more scores.
/// </summary>
/// <remarks>This is used to load the next "page" of scores. </remarks>
/// <param name="token">Token used to recording the loading.</param>
/// <param name="rowCount">Row count.</param>
/// <param name="callback">Callback invoked when complete.</param>
PlayGamesPlatform.Instance.LoadMoreScores(
    leaderboardScoreData.NextPageToken,
    10,
    (success) =>
    {
        //Looking the returned object
        Debug.Log("Load more scores info: " + success.ToString());
        //Do Anything...
    }
);

That Debug.Log return:

I/Unity: Load more scores info: [LeaderboardScoreData: mId=LeaderboardID,  mStatus=SuccessWithStale, mApproxCount=0, mTitle=]

The next page token and previous page token have a right token but Google play services can't use that, mTitle is void in the LeaderboardScoreData.

Can any tell me how to fix this token error?

Can I get the other scores with other methods? I can't use LoadScore again because start again to load users around the user, or if I can do it I don't know how to do it.

1 Answers1

0

For future problems with this, finally the fix is:

Activate Google Play Services in https://console.developers.google.com/apis/dashboard and the tokens will work correctly.