Unable to retrive google play game services leaderboard score

355 views Asked by At

I want to get users score from leaderboard connected to google play game services. I have 6 leaderboards from which game loads only 3 leaderboards other leaderboards data I get null.

if (mGoogleApiClient.isConnected()) {
    Games.Leaderboards.loadCurrentPlayerLeaderboardScore(mGoogleApiClient,
        getString(R.string.leaderboard_best_score__normal_mode),
        LeaderboardVariant.TIME_SPAN_ALL_TIME,
        LeaderboardVariant.COLLECTION_SOCIAL).setResultCallback(
        new ResultCallback < Leaderboards.LoadPlayerScoreResult > () {
            @Override
            public void onResult(Leaderboards.LoadPlayerScoreResult arg0) {
                Log.d("myleader", "score normal : " + mGoogleApiClient.isConnected());
                if (arg0.getScore() != null) {
                    LeaderboardScore c = arg0.getScore();
                    int s = (int) c.getRawScore();
                    Log.d("myleader", "score normal : " + s);
                }
            }
        });
    Games.Leaderboards.loadCurrentPlayerLeaderboardScore(mGoogleApiClient,
        getString(R.string.leaderboard_best_time__normal_mode),
        LeaderboardVariant.TIME_SPAN_ALL_TIME,
        LeaderboardVariant.COLLECTION_SOCIAL).setResultCallback(
        new ResultCallback < Leaderboards.LoadPlayerScoreResult > () {
            @Override
            public void onResult(Leaderboards.LoadPlayerScoreResult arg0) {
                if (arg0.getScore() != null) {
                    LeaderboardScore c = arg0.getScore();
                    long s = c.getRawScore();
                    Log.d("myleader", "time normal : " + s);
                }
            }
        });
    Games.Leaderboards.loadCurrentPlayerLeaderboardScore(mGoogleApiClient,
        getString(R.string.leaderboard_best_score__reverse_mode),
        LeaderboardVariant.TIME_SPAN_ALL_TIME,
        LeaderboardVariant.COLLECTION_SOCIAL).setResultCallback(
        new ResultCallback < Leaderboards.LoadPlayerScoreResult > () {
            @Override
            public void onResult(Leaderboards.LoadPlayerScoreResult arg0) {
                if (arg0.getScore() != null) {
                    LeaderboardScore c = arg0.getScore();
                    int s = (int) c.getRawScore();
                    Log.d("myleader", "score rev : " + s);
                }
            }
        });
    Games.Leaderboards.loadCurrentPlayerLeaderboardScore(mGoogleApiClient,
        getString(R.string.leaderboard_best_time__reverse_mode),
        LeaderboardVariant.TIME_SPAN_ALL_TIME,
        LeaderboardVariant.COLLECTION_SOCIAL).setResultCallback(
        new ResultCallback < Leaderboards.LoadPlayerScoreResult > () {
            @Override
            public void onResult(Leaderboards.LoadPlayerScoreResult arg0) {
                if (arg0.getScore() != null) {
                    LeaderboardScore c = arg0.getScore();
                    long s = c.getRawScore();
                    Log.d("myleader", "time rev : " + s);
                }
            }
        });
    Games.Leaderboards.loadCurrentPlayerLeaderboardScore(mGoogleApiClient,
        getString(R.string.leaderboard_best_time__zen_mode),
        LeaderboardVariant.TIME_SPAN_ALL_TIME,
        LeaderboardVariant.COLLECTION_SOCIAL).setResultCallback(
        new ResultCallback < Leaderboards.LoadPlayerScoreResult > () {
            @Override
            public void onResult(Leaderboards.LoadPlayerScoreResult arg0) {
                if (arg0.getScore() != null) {
                    LeaderboardScore c = arg0.getScore();
                    long s = c.getRawScore();
                    Log.d("myleader", "time zen : " + s);
                }
            }
        });
    Games.Leaderboards.loadCurrentPlayerLeaderboardScore(mGoogleApiClient,
        getString(R.string.leaderboard_best_time__search_mode),
        LeaderboardVariant.TIME_SPAN_ALL_TIME,
        LeaderboardVariant.COLLECTION_SOCIAL).setResultCallback(
        new ResultCallback < Leaderboards.LoadPlayerScoreResult > () {
            @Override
            public void onResult(Leaderboards.LoadPlayerScoreResult arg0) {
                if (arg0.getScore() != null) {
                    LeaderboardScore c = arg0.getScore();
                    long s = c.getRawScore();
                    Log.d("myleader", "Time search : " + s);
                }
            }
        });

I have score in all 6 leaderboards. Here in first 3 arg0.getScore() is not null and loads leaderboard score but in last 3 leaderboards it shows arg0.getScore() is null... cursor cannot reach to Log writer in that function.

All Leaderboard ID's are correct I have checked that twice before posting Thanks in advance.

0

There are 0 answers