【问题标题】:Android Google Play LeaderboardAndroid Google Play 排行榜
【发布时间】:2018-02-07 15:16:54
【问题描述】:

我开发了一款安卓游戏。我在游戏中使用了 Google Play 排行榜。 我的问题是排行榜分数未显示在应用程序中。排行榜界面出现,但显示“此游戏没有排行榜”。用户得分不显示。

这是保存分数代码

PendingResult<Leaderboards.LoadPlayerScoreResult> result = Games.Leaderboards.loadCurrentPlayerLeaderboardScore(getApiClient(),getString(R.string.number_guesses_leaderboard), LeaderboardVariant.TIME_SPAN_ALL_TIME, LeaderboardVariant.COLLECTION_PUBLIC);
                        result.setResultCallback(new ResultCallback<Leaderboards.LoadPlayerScoreResult>() {
                            @Override
                            public void onResult(Leaderboards.LoadPlayerScoreResult loadPlayerScoreResult) {
                                if(loadPlayerScoreResult != null && loadPlayerScoreResult.getScore() != null) {
                                    Games.Leaderboards.submitScore(getApiClient(), getString(R.string.number_guesses_leaderboard), loadPlayerScoreResult.getScore().getRawScore() + value);}
                                else {
                               Games.Leaderboards.submitScore(getApiClient(), getString(R.string.number_guesses_leaderboard), value); }
                            }}); 

有什么想法吗?我该怎么办?

【问题讨论】:

    标签: android google-play google-play-services google-play-games leaderboard


    【解决方案1】:

    确保您已在 Google Play 管理中心正确设置排行榜。在那里你会先Create your Leaderboard,然后你会Add Leaderboard to your game

    【讨论】: