【问题标题】:Google Play Game Services, Android, accepting quests in Play Gams appGoogle Play 游戏服务,Android,在 Play 游戏应用中接受任务
【发布时间】:2015-03-17 20:17:09
【问题描述】:

我正在处理Quality Checklist for Google Play Games Services

在第 9.2 点下

允许玩家接受来自 Play 游戏应用的任务。

当玩家点击 Play 游戏应用中的任务图块时,您的游戏必须显示允许玩家接受任务的视图。

我进入 Play 游戏应用。我找到了我的游戏。我看到了任务选项卡,我打开了它。我看到一个任务列表。每个任务图块上都写着“玩”。

现在,这个质量检查表希望我在他们进入游戏时显示一个特定的视图,以便接受任务。

我找不到与专门显示这样的视图有关的任何内容。我没有在用于启动我的应用的 Intent 中发现任何特殊信息。

如何确定您是从 Play 游戏应用中的特定任务图块进入我的游戏的?

或者我可以明确设置从这些任务图块中触发的不同活动吗?

【问题讨论】:

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


    【解决方案1】:

    我们为同一个问题花了几个小时,答案很简单。

    只需使用 https://developers.google.com/android/reference/com/google/android/gms/common/api/GoogleApiClient.ConnectionCallbacks

    和回调注册 https://developers.google.com/android/reference/com/google/android/gms/common/api/GoogleApiClient#registerConnectionCallbacks(com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks)

        gameHelper.getApiClient().registerConnectionCallbacks(
        new GoogleApiClient.ConnectionCallbacks() {
    
            @Override
            public void onConnected(Bundle bundle) {
                // If the game started via Accept quest button in Google Play Games,
                // we will got here a bundle with all information
                if (bundle == null)
                    return;
    
                QuestEntity questEntity = bundle.getParcelable(Games.Quests.EXTRA_QUEST);
    
                if (questEntity == null)
                    return;
    
               activity.startActivityForResult(Games.Quests.getQuestIntent(gameHelper.getApiClient(), questEntity.getQuestId()), REQUEST_CODE_QUEST_UI);
           }
    
           @Override
           void onConnectionSuspended(int cause){}
        });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-02-02
      • 2014-04-17
      • 1970-01-01
      • 2013-07-31
      • 2017-09-27
      • 2018-05-09
      • 1970-01-01
      相关资源
      最近更新 更多