I guess that by the time you are calling the leaderboard scores arent
loaded yet....

onLeaderboardScoresLoaded<https://developer.android.com/reference/com/google/android/gms/games/leaderboard/OnLeaderboardScoresLoadedListener.html#onLeaderboardScoresLoaded(int,
com.google.android.gms.games.leaderboard.LeaderboardBuffer,
com.google.android.gms.games.leaderboard.LeaderboardScoreBuffer)>(int
statusCode, 
LeaderboardBuffer<https://developer.android.com/reference/com/google/android/gms/games/leaderboard/LeaderboardBuffer.html>
 leaderboard, 
LeaderboardScoreBuffer<https://developer.android.com/reference/com/google/android/gms/games/leaderboard/LeaderboardScoreBuffer.html>
 scores)
Called when leaderboard scores have been loaded.

"The leaderboard scores that were requested. This is guaranteed to be
non-null, though it may be empty. The listener must close this object when
finished."


On Thu, May 30, 2013 at 3:34 PM, Guillermo Andrades <[email protected]>wrote:

> Hi,
>
> I'm in the middle of the integration of GPGS on my game and I'm facing a
> problem.
>
> I have two scoreboards registered in the dashboard and I've sent some
> scores for one. I'm trying to get the scores for the current player in all
> the scoreboards.
>
> When calling the method 
> loadPlayerCenteredScores<http://developer.android.com/reference/com/google/android/gms/games/GamesClient.html#loadPlayerCenteredScores(com.google.android.gms.games.leaderboard.OnLeaderboardScoresLoadedListener,%20java.lang.String,%20int,%20int,%20int)>
>  it
> should give me the Leaderboard object (in the LeaderboardBuffer) and one
> LeaderboardScore object (in the LeaderboardScoreBuffer) but the
> LeaderboardScoreBuffer is empty instead. Code:
>
> gamesHelper.getGamesClient().loadPlayerCenteredScores(new
> OnLeaderboardScoresLoadedListener() {
>  @Override
> public void onLeaderboardScoresLoaded(int arg0, LeaderboardBuffer arg1,
> LeaderboardScoreBuffer arg2) {
>  System.out.println("Count1: " + arg1.getCount());
> System.out.println("Count2: " + arg2.getCount());
>  for(LeaderboardScore jarl : arg2){
> System.out.println("This is never shown");
>  }
> }
> }, localScore.id, LeaderboardVariant.TIME_SPAN_ALL_TIME,
> LeaderboardVariant.COLLECTION_PUBLIC, 1);
>
>
>  The result:
>
> Count1: 1
> Count2: 0
>
>
>  If I try to retrieve the data using the variants 
> (getVariants()<http://developer.android.com/reference/com/google/android/gms/games/leaderboard/Leaderboard.html#getVariants()>)
> it works OK and I can retrieve the score for the current player. Code:
>
> Leaderboard serverScore = ...
> ArrayList<LeaderboardVariant> scoresVariant = serverScore.getVariants();
> for(LeaderboardVariant scoreVariant : scoresVariant){
> if(scoreVariant.getCollection() == LeaderboardVariant.COLLECTION_PUBLIC &&
> scoreVariant.getTimeSpan() == LeaderboardVariant.TIME_SPAN_ALL_TIME){
>  System.out.println("Score: " + scoreVariant.getRawPlayerScore());
> }
> }
>
>
> Is there anything that I'm doing wrong?
>
> Greetings
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
*Παύλος-Πέτρος Τουρνάρης*
*Android  & Software Developer*

   - *http://goo.gl/TsJ8u*
   - *http://acschedule.org*

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to