InvitationsClient

public class InvitationsClient extends GoogleApi<Games.GamesOptions>

A client to interact with invitations functionality.

Public Method Summary

Task<Intent>
getInvitationInboxIntent()
Returns a Task which asynchronously loads an Intent that will let the user see and manage any outstanding invitations.
Task<AnnotatedData<InvitationBuffer>>
loadInvitations()
Returns a Task which asynchronously loads an annotated InvitationBuffer containing the list of invitations for the current game.
Task<AnnotatedData<InvitationBuffer>>
loadInvitations(int sortOrder)
Returns a Task which asynchronously loads an annotated InvitationBuffer containing the list of invitations for the current game.
Task<Void>
registerInvitationCallback(InvitationCallback callback)
Returns a Task which asynchronously registers callbacks to intercept incoming invitations for the currently signed-in user.
Task<Boolean>
unregisterInvitationCallback(InvitationCallback callback)
Returns a Task which asynchronously unregisters this client's invitation callbacks, if any and loads the result.

Inherited Method Summary

Public Methods

public Task<Intent> getInvitationInboxIntent ()

Returns a Task which asynchronously loads an Intent that will let the user see and manage any outstanding invitations. Note that this must be invoked using startActivityForResult(Intent, int) so that the identity of the calling package can be established.

The returned Task can fail with a RemoteException.

If the user cancelled the result will be RESULT_CANCELED. If the user selected an invitation to accept, the result will be RESULT_OK and the data intent will contain the selected invitation as a parcelable extra in the extras. Based on the type of the match (TTMP/RBMP), the result will include either EXTRA_TURN_BASED_MATCH or EXTRA_INVITATION accessible from the Bundle's extras.

Required Scopes: SCOPE_GAMES_LITE

public Task<AnnotatedData<InvitationBuffer>> loadInvitations ()

Returns a Task which asynchronously loads an annotated InvitationBuffer containing the list of invitations for the current game. Invitations are returned sorted by most recent first.

release() should be called to release resources after usage.

Required Scopes: SCOPE_GAMES_LITE

public Task<AnnotatedData<InvitationBuffer>> loadInvitations (int sortOrder)

Returns a Task which asynchronously loads an annotated InvitationBuffer containing the list of invitations for the current game.

release() should be called to release resources after usage.

Required Scopes: SCOPE_GAMES_LITE

Parameters
sortOrder How to sort the returned invitations. Must be either SORT_ORDER_MOST_RECENT_FIRST or SORT_ORDER_SOCIAL_AGGREGATION.

public Task<Void> registerInvitationCallback (InvitationCallback callback)

Returns a Task which asynchronously registers callbacks to intercept incoming invitations for the currently signed-in user. If callbacks are registered by this method, the incoming invitation will not generate a status bar notification.

Note that only one invitation callback may be active at a time. Calling this method while another invitation callback was previously registered will replace the original callback with the new one.

Required Scopes: SCOPE_GAMES_LITE

Parameters
callback The callback that is called when a new invitation is received. The callback is called on the main thread.

public Task<Boolean> unregisterInvitationCallback (InvitationCallback callback)

Returns a Task which asynchronously unregisters this client's invitation callbacks, if any and loads the result. The result will be true if the callback was unregistered and false if this callback wasn't registered previously or is already unregistered. Any new invitations will generate status bar notifications as normal.

Required Scopes: SCOPE_GAMES_LITE