2
\$\begingroup\$
Games.Leaderboards.loadPlayerCenteredScores(mGoogleApiClient,leaderboardId, LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC, 5).setResultCallback(new ResultCallback<Leaderboards.LoadScoresResult>()
{
    public void onResult(Leaderboards.LoadScoresResult arg0) {
    // TODO Auto-generated method stub

       int size = arg0.getScores().getCount();
        Log.e("ACHGOD", "SIZE="+Integer.toString(size));

        for (int i = 0; i < 3; i++) {
            LeaderboardScore lbs = arg0.getScores().get(i);
            // String name = lbs.getScoreHolderDisplayName();
            String score = lbs.getDisplayScore();
            Log.e("ACHGOD", "SCORE="+score);
            //Uri urlimage = lbs.getScoreHolderHiResImageUri();
        }
        // arg0.getScores().close();
        arg0.getScores().release();
    }
});

I am getting the integer score value here. But, I could not find any proper documentation regarding the score value, which I get.

Is it the high score? Or, is it the last submitted score? I am looking to get the highest score made by the currently logged-in user from the leaderboard.

Thanks in advance.

\$\endgroup\$
1
\$\begingroup\$

The documentation isn't clear about the ordering of the scores. When the documentation doesn't guarantee any kind of order, guarantee it yourself.

I suggest you simply iterate through the list, keeping track of the largest (for O(N) time).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.