【问题标题】:Google Play Games Services - Unlocking several achievements at onceGoogle Play 游戏服务 - 一次解锁多项成就
【发布时间】:2014-10-28 06:36:53
【问题描述】:

我正在向已发布且拥有活跃用户的游戏添加成就。由于之前版本的应用没有此功能,可能会出现现有用户安装新版本时,我想查看他们过去的统计数据并在之后取消阻止一些成就。

所以,也许他们一登录 Google Play,我就需要发送大约 5-10 个成就。代码很好,但并不是所有的成就都被注册了。想象一下:

Games.Achievements.unlock(mGoogleApiClient, "ach_1");
Games.Achievements.unlock(mGoogleApiClient, "ach_2");
Games.Achievements.unlock(mGoogleApiClient, "ach_3");
Games.Achievements.unlock(mGoogleApiClient, "ach_4");
Games.Achievements.unlock(mGoogleApiClient, "ach_5");

其中只有少数会被 Google Play 记录下来。但是我确实注意到日志文件中有一些异常,例如:

Unexpected response code 401 for https://www.googleapis.com/games/v1/players/[id]

我怀疑我的请求被阻止了。有没有办法发送批量成就更新或任何其他方法来解决这个问题?

谢谢。

【问题讨论】:

    标签: android google-play


    【解决方案1】:

    尝试使用

    Games.Achievements.unlockImmediate(mGoogleApiClient, "ach_1" ).setResultCallback(new ResultCallback<UpdateAchievementResult>() {
    
            @Override
            public void onResult(UpdateAchievementResult res) {
                System.out.println(res.getStatus().getStatusCode());
            }
    
        });
    

    追踪成就解锁结果

    Achievements.UpdateAchievementResult

    【讨论】:

      猜你喜欢
      • 2014-01-11
      • 2014-07-08
      • 1970-01-01
      • 2015-03-01
      • 2013-06-27
      • 2013-11-23
      • 1970-01-01
      • 2023-04-01
      • 2014-12-15
      相关资源
      最近更新 更多