public interface

# GameManagerState

com.google.android.gms.cast.games.GameManagerState

## Class Overview

Represents a snapshot of the Game Manager's state.

## Summary

Public Methods
abstract CharSequence | getApplicationName() Returns the application name.
abstract List<PlayerInfo> | getConnectedControllablePlayers() Returns the list of all players that are in a connected state and were created by this sender device.
abstract List<PlayerInfo> | getConnectedPlayers() Returns the list of all players that are in a connected state.
abstract List<PlayerInfo> | getControllablePlayers() Returns the list of all the players created by this sender device.
abstract JSONObject | getGameData() Returns the game-specific data.
abstract CharSequence | getGameStatusText() Returns the game status text.
abstract int | getGameplayState() Returns the state of the game.
abstract Collection<String> | getListOfChangedPlayers(GameManagerState other) Returns a list of player IDs that are different between this object and the provided `GameManagerState`.
abstract int | getLobbyState() Returns the current state of the lobby.
abstract int | getMaxPlayers() Returns the maximum number of players allowed by the game.
abstract PlayerInfo | getPlayer(String playerId) Returns the `PlayerInfo` for the specified `playerId` or `null` if the player does not exist.
abstract Collection<PlayerInfo> | getPlayers() Returns an unmodifiable collection of all the players in the game.
abstract List<PlayerInfo> | getPlayersInState(int playerState) Returns a list of all players that are in the specified player state.
abstract boolean | hasGameDataChanged(GameManagerState other) Returns whether the game data is different between this object and the provided `GameManagerState`.
abstract boolean | hasGameStatusTextChanged(GameManagerState other) Returns whether the game status text is different between this object and the provided `GameManagerState`.
abstract boolean | hasGameplayStateChanged(GameManagerState other) Returns whether the gameplay state is different between this object and the provided `GameManagerState`.
abstract boolean | hasLobbyStateChanged(GameManagerState other) Returns whether the lobby state is different between this object and the provided `GameManagerState`.
abstract boolean | hasPlayerChanged(String playerId, GameManagerState other) Returns whether the player with the provided player ID has changed between this object and the provided `GameManagerState`.
abstract boolean | hasPlayerDataChanged(String playerId, GameManagerState other) Returns whether the player data of the player with the specified player ID has changed between this object and the provided `GameManagerState`.
abstract boolean | hasPlayerStateChanged(String playerId, GameManagerState other) Returns whether the player state of the player with the specified player ID has changed between this object and the provided `GameManagerState`.

## Public Methods

#### public abstract CharSequence getApplicationName ()

Returns the application name.

#### public abstract List<PlayerInfo> getConnectedControllablePlayers ()

Returns the list of all players that are in a connected state and were created by this sender device. A player is considered to be in a connected state if the associated `getPlayerState()` returns `PLAYER_STATE_IDLE`, `PLAYER_STATE_AVAILABLE`, `PLAYER_STATE_PLAYING` or `PLAYER_STATE_READY`.

##### See Also

- `isConnected()`
- `isControllable()`

#### public abstract List<PlayerInfo> getConnectedPlayers ()

Returns the list of all players that are in a connected state. A player is considered to be in a connected state if the associated `getPlayerState()` returns `PLAYER_STATE_IDLE`, `PLAYER_STATE_AVAILABLE`, `PLAYER_STATE_PLAYING` or `PLAYER_STATE_READY`.

##### See Also

- `isConnected()`

#### public abstract List<PlayerInfo> getControllablePlayers ()

Returns the list of all the players created by this sender device.

##### See Also

- `isControllable()`

#### public abstract JSONObject getGameData ()

Returns the game-specific data. May return `null`.

#### public abstract CharSequence getGameStatusText ()

Returns the game status text.

#### public abstract int getGameplayState ()

Returns the state of the game. Gameplay states are defined in `GameManagerClient` and start with `GAMEPLAY_STATE`.

#### public abstract Collection<String> getListOfChangedPlayers (GameManagerState other)

Returns a list of player IDs that are different between this object and the provided `GameManagerState`. This includes players that were added, removed, or have changed in any way.

#### public abstract int getLobbyState ()

Returns the current state of the lobby. Lobby states are defined in `GameManagerClient` and start with `LOBBY_STATE`.

#### public abstract int getMaxPlayers ()

Returns the maximum number of players allowed by the game.

#### public abstract PlayerInfo getPlayer (String playerId)

Returns the `PlayerInfo` for the specified `playerId` or `null` if the player does not exist.

##### Parameters

playerId | The id of the player.

#### public abstract Collection<PlayerInfo> getPlayers ()

Returns an unmodifiable collection of all the players in the game.

#### public abstract List<PlayerInfo> getPlayersInState (int playerState)

Returns a list of all players that are in the specified player state. Player states are defined in `GameManagerClient` and start with `PLAYER_STATE`.

##### Parameters

playerState | The player state to look for.

#### public abstract boolean hasGameDataChanged (GameManagerState other)

Returns whether the game data is different between this object and the provided `GameManagerState`.

#### public abstract boolean hasGameStatusTextChanged (GameManagerState other)

Returns whether the game status text is different between this object and the provided `GameManagerState`.

#### public abstract boolean hasGameplayStateChanged (GameManagerState other)

Returns whether the gameplay state is different between this object and the provided `GameManagerState`.

#### public abstract boolean hasLobbyStateChanged (GameManagerState other)

Returns whether the lobby state is different between this object and the provided `GameManagerState`.

#### public abstract boolean hasPlayerChanged (String playerId, GameManagerState other)

Returns whether the player with the provided player ID has changed between this object and the provided `GameManagerState`.

#### public abstract boolean hasPlayerDataChanged (String playerId, GameManagerState other)

Returns whether the player data of the player with the specified player ID has changed between this object and the provided `GameManagerState`.

#### public abstract boolean hasPlayerStateChanged (String playerId, GameManagerState other)

Returns whether the player state of the player with the specified player ID has changed between this object and the provided `GameManagerState`.