【问题标题】:Submitting score to leaderboards with Google Play Game Services使用 Google Play 游戏服务向排行榜提交分数
【发布时间】:2013-06-22 22:13:16
【问题描述】:

GamesClient.submitScore 是否需要在线连接?当用户离线时它是如何工作的?要提交的分数会保存在某种队列中,以便在有事情要做时执行,或者我必须先在本地保存分数,然后在 Google Play 游戏服务上更新?

【问题讨论】:

  • 来自文档:This form of the API is a fire-and-forget form. Use this if you do not need to be notified of the results of submitting the score, though note that the update may not be sent to the server until the next sync.来自GamesClient + STATUS_NETWORK_ERROR_OPERATION_DEFERRED if the device is offline or was otherwise unable to post the score to the server. The score was stored locally and will be posted to the server the next time the device is online and is able to perform a sync (no further action is required from the client).来自OnScoreSubmittedListener
  • 所以通常我可以在启动提交分数之前完全依赖 if (isSignedIn && isSupported)?

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


【解决方案1】:

是的,它需要网络连接。但是,您可以做的是在用户重新登录时使用 SharedPrefrences。这就是我在我的应用程序中所做的。您只需要确保离线玩游戏的人与稍后将登录的人相同。

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 2016-08-29
    • 2014-08-21
    • 2013-12-03
    • 1970-01-01
    • 2013-05-12
    • 2016-08-09
    • 2013-05-12
    • 1970-01-01
    • 2016-02-11
    相关资源
    最近更新 更多