首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Google排行榜中默认打开"All“而不是"Social”?

如何在Google排行榜中默认打开"All“而不是"Social”?
EN

Stack Overflow用户
提问于 2016-05-24 21:32:30
回答 2查看 705关注 0票数 4

我已经在我的android游戏应用程序中集成了谷歌排行榜。当我打开它时,默认情况下它会进入“社交”模式(也就是我的谷歌圈子)。我需要手动切换到“所有”模式(来自世界各地的玩家)。如何将"All“模式设为默认值?

EN

回答 2

Stack Overflow用户

发布于 2016-05-24 23:52:49

有一个接受所有参数的重载方法:getLeaderboardIntent (GoogleApiClient apiClient, String leaderboardId, int timeSpan, int collection)

您可以通过以下方式获取意图并显示所有排行榜:

代码语言:javascript
复制
Intent intent = Games.Leaderboards.getLeaderboardIntent(apiClient,
     leaderboardId, LeaderboardVariant.TIME_SPAN_ALL_TIME,
     LeaderboardVariant.COLLECTION_PUBLIC);

// REQUEST_LEADERBOARD is an arbitrary constant to check for in onActivityResult
activity.startActivityForResult(intent, REQUEST_LEADERBOARD);

有关更多信息,请参阅:https://developers.google.com/games/services/android/leaderboards#displaying_a_leaderboard

票数 1
EN

Stack Overflow用户

发布于 2016-06-11 02:26:44

根据谷歌文档,来自Clayton的以下答案看起来很完美。然而,我认为google文档和排行榜类之间存在不匹配。

如果你尝试一下:Games.Leaderboards.getLeaderboardIntent(GoogleApiClient apiClient, String leaderboardId),它是有效的。

如果你尝试:Games.Leaderboards.getLeaderboardIntent(GoogleApiClient apiClient, String leaderboardId, int timeSpan),它是有效的,但是不管int值是什么,你都会得到一个基于"All time“的排行榜。

如果您尝试(应该是您的anwser):Games.Leaderboards.getLeaderboardIntent(GoogleApiClient apiClient, String leaderboardId, int timeSpan, int collection),它不会工作(该方法不存在)。

为了说明我所说的“不存在”是什么意思,您可以看看我们的Leaderboard类应该是什么( 49到51行之间):https://github.com/gamea-fiks/ccc/blob/62156a697da41733afb23a63beed05e3b17a5784/sources/com/google/android/gms/games/leaderboard/Leaderboards.java

关于堆栈溢出的另一个问题也是关于这个问题的:https://stackoverflow.com/questions/32867659/how-to-show-public-collection-from-google-leaderboard-with-getleaderboardintent

顺便说一句,让我们希望它很快就会被纠正(或者我在什么地方错了)!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37415206

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档