public interface

# Invitations

com.google.android.gms.games.multiplayer.Invitations

## Class Overview

Entry point for invitations functionality.

## Summary

Nested Classes
interface | Invitations.LoadInvitationsResult | Result delivered when invitations have been loaded.

Public Methods
abstract Intent | getInvitationInboxIntent(GoogleApiClient apiClient) Returns an intent that will let the user see and manage any outstanding invitations.
abstract PendingResult<Invitations.LoadInvitationsResult> | loadInvitations(GoogleApiClient apiClient) Asynchronously load the list of invitations for the current game.
abstract PendingResult<Invitations.LoadInvitationsResult> | loadInvitations(GoogleApiClient apiClient, int sortOrder) Asynchronously load the list of invitations for the current game.
abstract void | registerInvitationListener(GoogleApiClient apiClient, OnInvitationReceivedListener listener) Register a listener to intercept incoming invitations for the currently signed-in user.
abstract void | unregisterInvitationListener(GoogleApiClient apiClient) Unregisters this client's invitation listener, if any.

## Public Methods

#### public abstract Intent getInvitationInboxIntent (GoogleApiClient apiClient)

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

If the user canceled 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`.

Required API: `API`
Required Scopes: `SCOPE_GAMES`

##### Parameters

apiClient | The `GoogleApiClient` to service the call.

##### Returns

- An `Intent` that can be started to view the invitation inbox UI.

#### public abstract PendingResult<Invitations.LoadInvitationsResult> loadInvitations (GoogleApiClient apiClient)

Asynchronously load the list of invitations for the current game. Invitations are returned sorted by most recent first.

Required API: `API`
Required Scopes: `SCOPE_GAMES`

##### Parameters

apiClient | The `GoogleApiClient` to service the call.

##### Returns

- `PendingResult` to access the data when available.

#### public abstract PendingResult<Invitations.LoadInvitationsResult> loadInvitations (GoogleApiClient apiClient, int sortOrder)

Asynchronously load the list of invitations for the current game.

Required API: `API`
Required Scopes: `SCOPE_GAMES`

##### Parameters

apiClient | The `GoogleApiClient` to service the call.
sortOrder | How to sort the returned invitations. Must be either `SORT_ORDER_MOST_RECENT_FIRST` or `SORT_ORDER_SOCIAL_AGGREGATION`.

##### Returns

- `PendingResult` to access the data when available.

#### public abstract void registerInvitationListener (GoogleApiClient apiClient, OnInvitationReceivedListener listener)

Register a listener to intercept incoming invitations for the currently signed-in user. If a listener is registered by this method, the incoming invitation will not generate a status bar notification as long as this client remains connected.

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

Required API: `API`
Required Scopes: `SCOPE_GAMES`

##### Parameters

apiClient | The `GoogleApiClient` to service the call.
listener | The listener that is called when a new invitation is received. The listener is called on the main thread.

#### public abstract void unregisterInvitationListener (GoogleApiClient apiClient)

Unregisters this client's invitation listener, if any. Any new invitations will generate status bar notifications as normal.

Required API: `API`
Required Scopes: `SCOPE_GAMES`

##### Parameters

apiClient | The `GoogleApiClient` to service the call.