A client to interact with Players.
Constant Summary
String | EXTRA_PLAYER_SEARCH_RESULTS | Used by the Player Search UI to return a list of parceled Player objects. |
Inherited Field Summary
Public Method Summary
Task<Intent> |
getCompareProfileIntent(Player player)
|
Task<Player> | |
Task<String> |
getCurrentPlayerId()
Returns a
Task
which asynchronously loads the current signed-in player ID, if available.
|
Task<Intent> | |
Task<AnnotatedData<PlayerBuffer>> |
loadMoreRecentlyPlayedWithPlayers(int pageSize)
Returns a
Task
which asynchronously loads annotated PlayerBuffer
that represents players the user has interacted with recently, starting with
the most recent.
|
Task<AnnotatedData<Player>> |
loadPlayer(String playerId,
boolean forceReload)
|
Task<AnnotatedData<Player>> |
loadPlayer(String playerId)
|
Task<AnnotatedData<PlayerBuffer>> |
loadRecentlyPlayedWithPlayers(int pageSize, boolean forceReload)
Returns a
Task
which asynchronously loads an annotated PlayerBuffer
that represents players the user has interacted with recently, starting with
the most recent.
|
Inherited Method Summary
Constants
public static final String EXTRA_PLAYER_SEARCH_RESULTS
Used by the Player Search UI to return a list of parceled Player objects. Retrieve
with
getParcelableArrayListExtra(String)
.
Public Methods
public Task<Intent> getCompareProfileIntent (Player player)
Returns a Task
which
asynchronously loads an Intent
that
will display a screen where the user can compare themselves against another player's
profile. Note that the Intent
returned from the Task
must be
invoked with
startActivityForResult(Intent, int)
, so that the identity of the calling
package can be established.
The returned Task
can fail with a RemoteException
.
Required Scopes: SCOPE_GAMES_LITE
public Task<Player> getCurrentPlayer ()
Returns a Task
which
asynchronously loads the current signed-in Player
, if
available.
The returned Task
can fail with a RemoteException
.
Required Scopes: SCOPE_GAMES_LITE
public Task<String> getCurrentPlayerId ()
Returns a Task
which
asynchronously loads the current signed-in player ID, if available.
The returned Task
can fail with a RemoteException
.
Required Scopes: SCOPE_GAMES_LITE
public Task<Intent> getPlayerSearchIntent ()
Returns a Task
which
asynchronously loads an Intent
that
will display a screen where the user can search for players.
Note that this must be invoked with
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 any players from the search results list, the result will be
RESULT_OK
,
and the data intent will contain a list of parceled Player objects in
EXTRA_PLAYER_SEARCH_RESULTS
.
Note that the current Player Search UI only allows a single selection, so the returned list of parceled Player objects will currently contain at most one Player.
The returned Task
can fail with a RemoteException
.
Required Scopes: SCOPE_GAMES_LITE
public Task<AnnotatedData<PlayerBuffer>> loadMoreRecentlyPlayedWithPlayers (int pageSize)
Returns a Task
which
asynchronously loads annotated PlayerBuffer
that represents players the user has interacted with recently, starting with the most
recent.
release()
should be called to release resources after usage.
Required Scopes: SCOPE_GAMES_LITE
Parameters
pageSize | The number of additional entries to request. This must be a value between 1 and 25. |
---|
public Task<AnnotatedData<Player>> loadPlayer (String playerId, boolean forceReload)
Returns a Task
which
asynchronously loads an annotated Player
profile
specified by playerId
.
The returned Task
can fail with a RemoteException
.
Required Scopes: SCOPE_GAMES_LITE
Parameters
playerId | The player ID to get full profile data for. |
---|---|
forceReload | If true , this call will clear any locally cached data and attempt
to fetch the latest data from the server. This would commonly be used for something
like a user-initiated refresh. Normally, this should be set to false
to gain advantages of data caching. |
public Task<AnnotatedData<Player>> loadPlayer (String playerId)
Returns a Task
which
asynchronously loads an annotated Player
profile
specified by playerId
.
Returns the locally cached player if available.
The returned Task
can fail with a RemoteException
.
Required Scopes: SCOPE_GAMES_LITE
Parameters
playerId | The player ID to get full profile data for. |
---|
public Task<AnnotatedData<PlayerBuffer>> loadRecentlyPlayedWithPlayers (int pageSize, boolean forceReload)
Returns a Task
which
asynchronously loads an annotated PlayerBuffer
that represents players the user has interacted with recently, starting with the most
recent.
release()
should be called to release resources after usage.
Required Scopes: SCOPE_GAMES_LITE
Parameters
pageSize | The number of entries to request for this initial page. Note that if cached data already exists, the returned buffer may contain more than this size, but it is guaranteed to contain at least this many if the collection contains enough records. This must be a value between 1 and 25. |
---|---|
forceReload | If true , this call will clear any locally cached data and attempt
to fetch the latest data from the server. This would commonly be used for something
like a user-initiated refresh. Normally, this should be set to false
to gain advantages of data caching. |