【问题标题】:Where is getApiClient on BaseGameActivity?BaseGameActivity 上的 getApiClient 在哪里?
【发布时间】:2014-02-14 16:13:00
【问题描述】:

https://developers.google.com/games/services/android/init 的 Google 文档说

您的游戏必须具有对 GoogleApiClient 对象的引用才能按顺序 对 Play 游戏服务进行任何 API 调用。在其期间 活动的生命周期,您的游戏可以检索 GoogleApiClient 在 onCreate() 之后的任何时间,通过调用 getApiClient() 来创建对象。为了 示例:

Games.Leaderboards.submitScore(getApiClient(), LB_ID, 12345);

最初页面还显示:

BaseGameActivity 类封装了 GoogleApiClient,从而降低了与 Google Play 服务器建立连接和管理用户登录的复杂性。

但是,我在BaseGameActivityGameHelper 中找不到getApiClient()。它在哪里?

【问题讨论】:

    标签: android google-play-services


    【解决方案1】:

    BaseGameActivity 是围绕 GamesClient 的包装类,自 2014 年 2 月 7 日起已弃用。

    您可以将BaseGameActivityGamesClientGoogleApiClient 一起使用。

    我认为文档还没有完成。这是昨天的。

    要使用GoogleApiClient,请参阅

    https://developers.google.com/games/services/training/signin#signing_the_player_in_at_startup

    【讨论】:

      【解决方案2】:

      在我回家之前我无法查看自己的代码,但也许我的记忆力足够好:-)。我不相信我在任何地方都使用 getApiClient() 。也许 BaseGameActivity 正在为你做那部分。您可能需要 getGamesClient() 代替。再次,凭记忆,所以这可能是无用的废话:-)。

      【讨论】:

        【解决方案3】:

        今天他们更新了 BaseGameActivity 以使用新的 GoogleApiClient。显然他们在代码前几天更新了文档。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-10-26
          • 2012-01-04
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多