android - How to get score from google play game service's leaderboard of current player? -
currently doing game integrated google game play service , want compression score between score , best of score, easy inform player getting new high score. don't how getscore google game service leaderboard, can please guide me on how it?
i able display leaderboard can't find way how score user playing.
my code showing leaderboard:
if (issignedin()) { if(inscore<=50) { games.leaderboards.submitscore(getapiclient(), getstring(r.string.leaderboard_easy), inscore); } else { games.leaderboards.submitscore(getapiclient(), getstring(r.string.leaderboard_hard), inscore); } } else { log.d("not signed", "not signed in"); }
i want score user playing on device, me please.
this how i'm fetching score of current player:
private void loadscoreofleaderboard() { games.leaderboards.loadcurrentplayerleaderboardscore(getapiclient(), getstring(r.string.your_leaderboard_id), leaderboardvariant.time_span_all_time, leaderboardvariant.collection_public).setresultcallback(new resultcallback<leaderboards.loadplayerscoreresult>() { @override public void onresult(final leaderboards.loadplayerscoreresult scoreresult) { if (isscoreresultvalid(scoreresult)) { // here can score mpoints = scoreresult.getscore().getrawscore(); } } }); } private boolean isscoreresultvalid(final leaderboards.loadplayerscoreresult scoreresult) { return scoreresult != null && gamesstatuscodes.status_ok == scoreresult.getstatus().getstatuscode() && scoreresult.getscore() != null; }
Comments
Post a Comment