【问题标题】:Android Turnbased multiplayer detected incorrect implementation Google Play Game Services alertAndroid 回合制多人游戏检测到不正确的实现 Google Play 游戏服务警报
【发布时间】:2014-10-28 01:28:54
【问题描述】:

我已使用 Google Play 游戏服务发布了一个 Android 应用,并收到了一条警告,称它“检测到错误的实现”。调查这意味着什么,我发现...

此游戏已实施邀请,但不允许用户通过邀请加入比赛。不鼓励这种方法,因为它可能会导致糟糕的用户体验。

由于我将此游戏基于示例项目 (TypeANumber),因此我不确定我需要做什么才能遵守此警报。我应该在会导致此警报的代码中寻找什么,因为我很高兴地邀请并与我的朋友对战并且没有遇到过这样的问题。

【问题讨论】:

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


    【解决方案1】:

    我遇到过(现在已清除)此警报。我建议如下:

    如果你已经实现了 OnInvitationReceivedListener 即

    class myClass extends Fragment implements OnInvitationReceivedListener, ... 
    

    并且不想自己处理,那么只需从您的 实现子句。这就是我所做的,它清除了警报。

    或者,如果您确实想要处理邀请,那么除了在 implements 子句中拥有 OnInvitationReceivedListener 之外,您还需要在运行时注册邀请侦听器,即

    Games.Invitations.registerInvitationListener(getApiClient(), this)
    

    并提供侦听器代码,即

    public void onInvitationReceived(Invitation invitation) {
          ...
    }
    

    【讨论】:

    • 感谢@IanB,但我已经有了监听器代码,就像在 tbmpSkeleton 示例中一样
    • // 处理通知事件。 @Override public void onInvitationReceived(Invitation邀请) { Toast.makeText( this, "一个邀请已经从" +邀请.getInviter().getDisplayName(), TOAST_DELAY) .show(); }
    • 您是否注册了侦听器,因为我认为示例中缺少该侦听器?
    • 是的。这行代码在函数 OnSignInSucceeded()
    • Games.Invitations.registerInvitationListener(getApiClient(), this);
    猜你喜欢
    • 2015-05-22
    • 1970-01-01
    • 2016-06-24
    • 2014-03-07
    • 2015-03-13
    • 1970-01-01
    • 1970-01-01
    • 2014-09-17
    相关资源
    最近更新 更多