Java Code Examples for com.google.android.gms.games.multiplayer.Invitation#getInvitationId()

The following examples show how to use com.google.android.gms.games.multiplayer.Invitation#getInvitationId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GameHelper.java    From google-play-game-services-ane with MIT License 6 votes vote down vote up
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint.getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 2
Source File: GameHelper.java    From ANE-Google-Play-Game-Services with Apache License 2.0 6 votes vote down vote up
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 3
Source File: GameHelper.java    From Asteroid with Apache License 2.0 5 votes vote down vote up
/**
 * Called when we successfully obtain a connection to a client.
 */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 4
Source File: GameHelper.java    From Trivia-Knowledge with Apache License 2.0 5 votes vote down vote up
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 5
Source File: RealTimeMultiplayer.java    From godot-gpgs with MIT License 5 votes vote down vote up
@Override
public void onInvitationReceived(Invitation invitation) {
    // We got an invitation to play a game! So, store it in
    // mIncomingInvitationId
    // and show the popup on the screen.
    incomingInvitationId = invitation.getInvitationId();
    Log.e(TAG, "GPGS: Invitation received " + incomingInvitationId);
    GodotLib.calldeferred(instanceId, "_on_gpgs_rtm_invitation_received", new Object[] { });
}
 
Example 6
Source File: GameHelper.java    From dice-heroes with GNU General Public License v3.0 5 votes vote down vote up
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 7
Source File: GameHelper.java    From FixMath with Apache License 2.0 5 votes vote down vote up
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 8
Source File: GameHelper.java    From martianrun with Apache License 2.0 5 votes vote down vote up
/**
 * Called when we successfully obtain a connection to a client.
 */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 9
Source File: GameHelper.java    From ColorPhun with Apache License 2.0 5 votes vote down vote up
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 10
Source File: GameHelper.java    From io2014-codelabs with Apache License 2.0 5 votes vote down vote up
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 11
Source File: GameHelper.java    From io2014-codelabs with Apache License 2.0 5 votes vote down vote up
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 12
Source File: GameHelper.java    From Onesearch with MIT License 5 votes vote down vote up
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 13
Source File: GameHelper.java    From tedroid with Apache License 2.0 5 votes vote down vote up
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 14
Source File: GameHelper.java    From FlappyCow with MIT License 5 votes vote down vote up
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 15
Source File: GameHelper.java    From cordova-google-play-games-services with MIT License 5 votes vote down vote up
/** Called when we successfully obtain a connection to a client. */
@Override
public void onConnected(Bundle connectionHint) {
    debugLog("onConnected: connected!");

    if (connectionHint != null) {
        debugLog("onConnected: connection hint provided. Checking for invite.");
        Invitation inv = connectionHint
                .getParcelable(Multiplayer.EXTRA_INVITATION);
        if (inv != null && inv.getInvitationId() != null) {
            // retrieve and cache the invitation ID
            debugLog("onConnected: connection hint has a room invite!");
            mInvitation = inv;
            debugLog("Invitation ID: " + mInvitation.getInvitationId());
        }

        // Do we have any requests pending?
        mRequests = Games.Requests
                .getGameRequestsFromBundle(connectionHint);
        if (!mRequests.isEmpty()) {
            // We have requests in onConnected's connectionHint.
            debugLog("onConnected: connection hint has " + mRequests.size()
                    + " request(s)");
        }

        debugLog("onConnected: connection hint provided. Checking for TBMP game.");
        mTurnBasedMatch = connectionHint
                .getParcelable(Multiplayer.EXTRA_TURN_BASED_MATCH);
    }

    // we're good to go
    succeedSignIn();
}
 
Example 16
Source File: MainActivity.java    From android-basic-samples with Apache License 2.0 5 votes vote down vote up
@Override
public void onInvitationReceived(@NonNull Invitation invitation) {
  // We got an invitation to play a game! So, store it in
  // mIncomingInvitationId
  // and show the popup on the screen.
  mIncomingInvitationId = invitation.getInvitationId();
  ((TextView) findViewById(R.id.incoming_invitation_text)).setText(
      invitation.getInviter().getDisplayName() + " " +
          getString(R.string.is_inviting_you));
  switchToScreen(mCurScreen); // This will show the invitation popup
}