如何获得Google Play游戏中的当前用户玩家分数?

时间:2019-01-31 01:15:23

标签: android google-play-games leaderboard

我尝试了以下代码:

 public void skorAl() {
    Games.getLeaderboardsClient(this, GoogleSignIn.getLastSignedInAccount(this))                .loadCurrentPlayerLeaderboardScore(getString(R.string.leaderboard_skor_tablosu),LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC)
            .addOnSuccessListener(this,new OnSuccessListener<AnnotatedData<LeaderboardScore>>() {
                @Override
                public void onSuccess(AnnotatedData<LeaderboardScore> leaderboardScoreAnnotatedData) {
                    if (leaderboardScoreAnnotatedData != null) {
                        if (leaderboardScoreAnnotatedData.get() != null) {
                            longScore = leaderboardScoreAnnotatedData.get().getRawScore();
                        }
                    }
               }                });
}

我为longScore得到了0。我不知道我在做什么错。我想获得当前的用户分数。我猜想GoogleSignIn.getLastSignedInAccount(this)命令无法正常工作。

0 个答案:

没有答案