我曾经使用以下方法从谷歌玩游戏排行榜获取玩家排名。现在谷歌播放服务库得到了更新。我不确定如何获得当前玩家的排名。请协助。
private void accessGooglePlayRank() {
Log.i("AndroidLauncher", "Rank : accessGooglePlayRank");
Games.Leaderboards.loadCurrentPlayerLeaderboardScore(gameHelper.getApiClient(),
leaderBoardID,
LeaderboardVariant.TIME_SPAN_ALL_TIME,
LeaderboardVariant.COLLECTION_PUBLIC).setResultCallback(new ResultCallback<Leaderboards.LoadPlayerScoreResult>() {
@Override
public void onResult(Leaderboards.LoadPlayerScoreResult loadPlayerScoreResult) {
if (loadPlayerScoreResult != null && loadPlayerScoreResult.getScore() != null) {
globalRank = loadPlayerScoreResult.getScore().getDisplayRank();
gotRank=true;
}
}
});
}