gpt4 book ai didi

Android 排行榜不会显示

转载 作者:太空狗 更新时间:2023-10-29 14:04:20 26 4
gpt4 key购买 nike

我使用以下方法提交分数时没有任何错误:

public void submitScore(int score)
{
Games.Leaderboards.submitScore(mGoogleApiClient, "leaderboard_easy_leaderboard", score);
}

但是当我运行显示排行榜代码时:

public void displayScores()
{
startActivityForResult(Games.Leaderboards.getLeaderboardIntent(mGoogleApiClient, "leaderboard_easy_leaderboard"), 0);
}

我收到以下错误:

11-07 17:00:39.873 32580-1830/? E/Volley: [161] BasicNetwork.performRequest: Unexpected response code 400 for https://www.googleapis.com/games/v1/leaderboards/leaderboard_easy_leaderboard?language=en_US

11-07 17:00:39.882 32580-9774/? E/LeaderboardAgent: Unable to retrieve leaderboard leaderboard_easy_leaderboard

11-07 17:00:39.882 32580-9774/? E/LeaderboardAgent: No instance found for leaderboard leaderboard_easy_leaderboard for SOCIAL and ALL_TIME

googleapis 链接显示以下文本:

{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}

最佳答案

我需要做的就是:

getString(R.string.leaderboard_easy_leaderboard)

代替:

"leaderboard_easy_leaderboard"

所以最终的解决方案是:

public void displayScores()
{
startActivityForResult(Games.Leaderboards.getLeaderboardIntent(mGoogleApiClient, getString(R.string.leaderboard_easy_leaderboard)), 0);
}

关于Android 排行榜不会显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33588574/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com