My requirement is to get top 5 scores from leaderboard and display it in my app.
There is a method loadTopScores but it shows the scores in its own UI i guess.
mGamesClint.loadTopScores(new OnLeaderboardScoresLoadedListener() {
public void onLeaderboardScoresLoaded(int arg0, LeaderboardBuffer arg1,
LeaderboardScoreBuffer arg2) {
// TODO Auto-generated method stub
}
}, LEADERBOARD_ID,LeaderboardVariant.TIME_SPAN_ALL_TIME , LeaderboardVariant.COLLECTION_PUBLIC, 5, true);
So is there any way I can get individual data like Name and score..?
Name 1 : Name of the top scorer 1 score 1 : score of the top scorer 1
Name 2 : Name of the top scorer 2 score 2 : score of the top scorer 2
......and so on
I just want name string and score integer so that I can use it in my game.
Please suggest me some ideas
My Solution which worked is as follows which is for the latest game play services.
Games.Leaderboards.loadTopScores(mGamesClint,LEADERBOARD_ID, LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC, 5).setResultCallback(new ResultCallback<Leaderboards.LoadScoresResult>() {
public void onResult(LoadScoresResult arg0) {
// TODO Auto-generated method stub
int size = arg0.getScores().getCount();
for ( int i = 0; i < 3; i++ ) {
LeaderboardScore lbs = arg0.getScores().get(i);
String name = lbs.getScoreHolderDisplayName();
String score = lbs.getDisplayScore();
Uri urlimage = lbs.getScoreHolderHiResImageUri();
}
}
you can get all the data from leaderboard users here including high resolution image ie. profile picture. Hope you get the idea here.