Skip to content Skip to sidebar Skip to footer

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

Solution 1:

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.

Solution 2:

I was having similar issues. (I still haven't cracked the code on the invite Bundle not being null everytime I start up the service... even when there are invitations waiting...)

From here Previous StackOverflow issue for Invitaion Listener I did get the issue mostly solved. (in that i do get notifications in my app code that a new invite has come in) However, there is nothing to tell you if an invite has been rescinded...

So, I also run a Timer and do this in my code:

@OverridepublicvoidloadInvitations(){
        mHelper.getGamesClient().loadInvitations(newOnInvitationsLoadedListener() {

            @OverridepublicvoidonInvitationsLoaded(int statusCode, InvitationBuffer buffer) {
                dLog("invitations loaded " + buffer.getCount());
                if(mHelper.getGamesClient().STATUS_OK == statusCode  && buffer.getCount() > 0){
                    if(mGHInterface != null){
                        mGHInterface.haveInvitations(buffer.getCount());
                    } 
                } elseif (mGHInterface != null){
                    mGHInterface.haveInvitations(0);
                }

            }
        });
    }

Up to you on how often you want to run this, but this way I have found that at least I do know if invitations exist or not, and update my app's actions accordingly.

Post a Comment for "Oninvitationreceived Not Being Called"