android - Display only Social Leader board using Google Play Game Services -
i working on android game want display leader board user's social circle on google plus. have integrated google play game services api in app , displaying leader board. however, google services displays 2 kinds of leader boards -- social , public, want display social leader board , not public.
is there way can that? or there way can fetch data social leaderboard alone , display separately?
so have figured out myself, luckily. following code print names of friends present @ social leader board.
games.leaderboards.loadplayercenteredscores(googleapiclient, "*****************", 2, 1, 20).setresultcallback( new resultcallback<loadscoresresult>(){ public void onresult(loadscoresresult result) { // todo auto-generated method stub for(int j=0;j<result.getscores().getcount();j++) { log.i("score on create",result.getscores().get(j).getscoreholderdisplayname()); } result.getscores().close(); } });
the first parameter googleapiclinet returned getapiclient() method.
the second parameter leader board id.
the third parameter time span. here, 2 indicates time_span_all_time
the fourth parameter leaderboardcollection. here, 1 indicates collection_social.
you can use same code obtaining other information such formatted rank, scores, , profile picture url. replace getscoreholderdisplayname() other appropriate methods.
Comments
Post a Comment