Search code examples
javaandroidlistenersgoogle-play-games

onInvitationReceived Not Being Called


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");
    }
}

Solution

  • 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.