onInvitationReceived不会被调用 [英] onInvitationReceived Not Being Called

查看:274
本文介绍了onInvitationReceived不会被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的活动与所有其他游戏服务项目一起实施OnInvitationReceivedListener。它要求我实现了onInvitationReceived功能(即,如果我没有给出一个错误),所以这是很好的。问题是,我可以把我的帐户邀请,它不会调用onInvitationReceived功能。其他监听工作,我可以通过打开邀请名单,并接受它启动游戏和诸如此类的东西,但这个功能根本不会被调用。还应该消耗的事件,但我仍然得到外部通知为好。

我缺少的东西吗?这不是那么简单,下面?所有其他的侦听器的工作......

 公共类MyActivity扩展BaseGameActivity
    实现View.OnClickListener,RealTimeMessageReceivedListener,
    RoomStatusUpdateListener,RoomUpdateListener,OnInvitationReceivedListener
{
    公共MyActivity(){...}
    ...    公共无效onInvitationReceived(邀请为arg0)
    {
        Log.v(咩,收到邀请函);
    }
}


解决方案

您注册 MyActivity 回调?

由于您使用的 BaseGameActivity ,尝试把这个在您连接后回调:

  getGamesClient()registerInvitationListener(本)。

我有些诧异,这不是为你做,但在看 BaseGameActivity 类我没有看到它。

My Activity is implementing OnInvitationReceivedListener along with all the other game services items. It requires that I have the onInvitationReceived function implemented (i.e. gives an error if I don't) so that's good. The problem is, I can send my account an invite and it will not call the onInvitationReceived function. The other listeners work and I can start a game and whatnot by opening the invitation list and accepting it, but this function simply never gets called. It should also consume the event but I still get an external notification as well.

Am I missing something? Is it not as simple as the below? All the other listeners work...

public class MyActivity extends BaseGameActivity
    implements View.OnClickListener, RealTimeMessageReceivedListener,
    RoomStatusUpdateListener, RoomUpdateListener, OnInvitationReceivedListener
{
    public MyActivity(){...}
    ...

    public void onInvitationReceived(Invitation arg0) 
    {
        Log.v("meh", "Invitation Received");
    }
}

解决方案

Are you registering MyActivity for the callback?

Since you are using BaseGameActivity, try putting this in your post-connection callback:

getGamesClient().registerInvitationListener(this);

I'm somewhat surprised that this isn't done for you, but in looking at the BaseGameActivity class I don't see it.

这篇关于onInvitationReceived不会被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆