Players

public interface Players

This interface is deprecated.
Use PlayersClient instead

Entry point for player functionality.

Nested Class Summary

interface Players.LoadPlayersResult This interface is deprecated. Player is returned directly in the PlayersClient.  

Constant Summary

String EXTRA_PLAYER_SEARCH_RESULTS Used by the Player Search UI to return a list of parceled Player objects.

Public Method Summary

abstract Intent
getCompareProfileIntent(GoogleApiClient apiClient, Player player)
Returns an intent that will display a screen where the user can compare themselves against another player's profile.
abstract Player
getCurrentPlayer(GoogleApiClient apiClient)
Get the current signed in player, if available.
abstract String
getCurrentPlayerId(GoogleApiClient apiClient)
Get the current signed in player ID, if available.
abstract Intent
getPlayerSearchIntent(GoogleApiClient apiClient)
Returns an intent that will display a screen where the user can search for players.
abstract PendingResult<Players.LoadPlayersResult>
loadConnectedPlayers(GoogleApiClient apiClient, boolean forceReload)
This method is deprecated. Google+ no longer integrated so social APIs will not work as expected. See Play Games authentication adopting Google Sign-In API
abstract PendingResult<Players.LoadPlayersResult>
loadInvitablePlayers(GoogleApiClient apiClient, int pageSize, boolean forceReload)
This method is deprecated. Google+ no longer integrated so social APIs will not work as expected. See Play Games authentication adopting Google Sign-In API
abstract PendingResult<Players.LoadPlayersResult>
loadMoreInvitablePlayers(GoogleApiClient apiClient, int pageSize)
This method is deprecated. Google+ no longer integrated so social APIs will not work as expected. See Play Games authentication adopting Google Sign-In API
abstract PendingResult<Players.LoadPlayersResult>
loadMoreRecentlyPlayedWithPlayers(GoogleApiClient apiClient, int pageSize)
Asynchronously loads an additional page of players that the signed-in player has played multiplayer games with recently.
abstract PendingResult<Players.LoadPlayersResult>
loadPlayer(GoogleApiClient apiClient, String playerId)
Loads the profile for the requested player ID.
abstract PendingResult<Players.LoadPlayersResult>
loadPlayer(GoogleApiClient apiClient, String playerId, boolean forceReload)
Loads the profile for the requested player ID.
abstract PendingResult<Players.LoadPlayersResult>
loadRecentlyPlayedWithPlayers(GoogleApiClient apiClient, int pageSize, boolean forceReload)
Load the initial page of players the currently signed-in player has played multiplayer games with recently, starting with the most recent.

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 Intent.getParcelableArrayListExtra(String).

See getPlayerSearchIntent(GoogleApiClient)

Constant Value: "player_search_results"

Public Methods

public abstract Intent getCompareProfileIntent (GoogleApiClient apiClient, Player player)

Returns an intent that will display a screen where the user can compare themselves against another player's profile. Note that this must be invoked with Activity.startActivityForResult(Intent, int), so that the identity of the calling package can be established.

Required API: Games.API
Required Scopes: Games.SCOPE_GAMES

Parameters
apiClient The GoogleApiClient to service the call.
player
Returns
  • An Intent that can be started to display the player profile.

public abstract Player getCurrentPlayer (GoogleApiClient apiClient)

Get the current signed in player, if available.

Required API: Games.API
Required Scopes: Games.SCOPE_GAMES

Parameters
apiClient The GoogleApiClient to service the call.
Returns
  • Player representing the currently signed in player. May be null if an error occurred while communicating with the games service.

public abstract String getCurrentPlayerId (GoogleApiClient apiClient)

Get the current signed in player ID, if available.

Required API: Games.API
Required Scopes: Games.SCOPE_GAMES

Parameters
apiClient The GoogleApiClient to service the call.
Returns
  • The player ID for the currently signed in player. May be null if an error occurred while communicating with the games service.

public abstract Intent getPlayerSearchIntent (GoogleApiClient apiClient)

Returns an intent that will display a screen where the user can search for players. Note that this must be invoked with Activity.startActivityForResult(Intent, int), so that the identity of the calling package can be established.

If the user canceled, the result will be Activity.RESULT_CANCELED. If the user selected any players from the search results list, the result will be Activity.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.

Required API: Games.API
Required Scopes: Games.SCOPE_GAMES

Parameters
apiClient The GoogleApiClient to service the call.
Returns
  • An Intent that can be started to display the player selector.

public abstract PendingResult<Players.LoadPlayersResult> loadConnectedPlayers (GoogleApiClient apiClient, boolean forceReload)

This method is deprecated.
Google+ no longer integrated so social APIs will not work as expected. See Play Games authentication adopting Google Sign-In API

Asynchronously loads a list of players that have connected to this game (and that the user has permission to know about).

Required API: Games.API
Required Scopes: Games.SCOPE_GAMES

Parameters
apiClient The GoogleApiClient to service the call.
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 abstract PendingResult<Players.LoadPlayersResult> loadInvitablePlayers (GoogleApiClient apiClient, int pageSize, boolean forceReload)

This method is deprecated.
Google+ no longer integrated so social APIs will not work as expected. See Play Games authentication adopting Google Sign-In API

Load the initial page of players the currently signed-in player can invite to a multiplayer game, sorted alphabetically by name.

Required API: Games.API
Required Scopes: Games.SCOPE_GAMES

Parameters
apiClient The GoogleApiClient to service the call.
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.
Returns

public abstract PendingResult<Players.LoadPlayersResult> loadMoreInvitablePlayers (GoogleApiClient apiClient, int pageSize)

This method is deprecated.
Google+ no longer integrated so social APIs will not work as expected. See Play Games authentication adopting Google Sign-In API

Asynchronously loads an additional page of invitable players. A new player buffer will be delivered that includes an extra page of results.

Required API: Games.API
Required Scopes: Games.SCOPE_GAMES

Parameters
apiClient The GoogleApiClient to service the call.
pageSize The number of additional entries to request. This must be a value between 1 and 25.
Returns

public abstract PendingResult<Players.LoadPlayersResult> loadMoreRecentlyPlayedWithPlayers (GoogleApiClient apiClient, int pageSize)

Asynchronously loads an additional page of players that the signed-in player has played multiplayer games with recently. A new player buffer will be delivered that includes an extra page of results.

Required API: Games.API
Required Scopes: Games.SCOPE_GAMES

Parameters
apiClient The GoogleApiClient to service the call.
pageSize The number of additional entries to request. This must be a value between 1 and 25.
Returns

public abstract PendingResult<Players.LoadPlayersResult> loadPlayer (GoogleApiClient apiClient, String playerId)

Loads the profile for the requested player ID.

Required API: Games.API
Required Scopes: Games.SCOPE_GAMES

Parameters
apiClient The GoogleApiClient to service the call.
playerId The player ID to get full profile data for.
Returns

public abstract PendingResult<Players.LoadPlayersResult> loadPlayer (GoogleApiClient apiClient, String playerId, boolean forceReload)

Loads the profile for the requested player ID.

Required API: Games.API
Required Scopes: Games.SCOPE_GAMES

Parameters
apiClient The GoogleApiClient to service the call.
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.
Returns

public abstract PendingResult<Players.LoadPlayersResult> loadRecentlyPlayedWithPlayers (GoogleApiClient apiClient, int pageSize, boolean forceReload)

Load the initial page of players the currently signed-in player has played multiplayer games with recently, starting with the most recent.

Required API: Games.API
Required Scopes: Games.SCOPE_GAMES

Parameters
apiClient The GoogleApiClient to service the call.
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.
Returns