Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

close

- - Get Started
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
    - Get the SDK
  - Google Services
- - Google Play
  - Publishing
  - Promoting
  - App Quality
  - Spotlight
  - Open Distribution

## Results

Loading...
Summary: Constants | Inherited Constants | Methods | Inherited Methods | [Expand All]
public interface

# Room

implements Parcelable Freezable<T> Participatable

com.google.android.gms.games.multiplayer.realtime.Room

Known Indirect Subclasses
RoomEntity

RoomEntity | Data object representing the data for a room.

## Class Overview

Data interface for room functionality.

## Summary

Constants
int | ROOM_STATUS_ACTIVE | Constant returned by `getStatus()` indicating that the room is active and connections are established.
int | ROOM_STATUS_AUTO_MATCHING | Constant returned by `getStatus()` indicating that one or more slots are waiting to be filled by auto-matching.
int | ROOM_STATUS_CONNECTING | Constant returned by `getStatus()` indicating that this room is waiting for clients to connect to each other.
int | ROOM_STATUS_INVITING | Constant returned by `getStatus()` indicating that the room has one or more players that have been invited and have not responded yet.
int | ROOM_VARIANT_ANY | Constant used to indicate that the variant for a room is unspecified.

[Expand] Inherited Constants

From interface android.os.Parcelable

int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Public Methods
abstract Bundle | getAutoMatchCriteria() Retrieves the automatch criteria used to create or join this room, if any.
abstract int | getAutoMatchWaitEstimateSeconds() Retrieves the estimated wait time for automatching to finish for players who are not automatched immediately, as measured from the time that the room entered the automatching pool.
abstract long | getCreationTimestamp()
abstract String | getCreatorId()
abstract String | getDescription()
abstract void | getDescription(CharArrayBuffer dataOut) Loads the room description into the given `CharArrayBuffer`.
abstract Participant | getParticipant(String participantId) Get a participant in a room by its ID.
abstract String | getParticipantId(String playerId) Get the participant ID for a given player.
abstract ArrayList<String> | getParticipantIds() Get the IDs of the participants of the given room.
abstract int | getParticipantStatus(String participantId) Get the status of a participant in a room.
abstract String | getRoomId()
abstract int | getStatus()
abstract int | getVariant()

[Expand] Inherited Methods

From interface android.os.Parcelable

abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

From interface com.google.android.gms.common.data.Freezable

abstract T | freeze() Freeze a volatile representation into an immutable representation.
abstract boolean | isDataValid() Check to see if this object is valid for use.

From interface com.google.android.gms.games.multiplayer.Participatable

abstract ArrayList<Participant> | getParticipants() Retrieve the `Participant`s for this object.

## Constants

#### public static final int ROOM_STATUS_ACTIVE

Constant returned by `getStatus()` indicating that the room is active and connections are established.

Constant Value: 3 (0x00000003)

#### public static final int ROOM_STATUS_AUTO_MATCHING

Constant returned by `getStatus()` indicating that one or more slots are waiting to be filled by auto-matching.

Constant Value: 1 (0x00000001)

#### public static final int ROOM_STATUS_CONNECTING

Constant returned by `getStatus()` indicating that this room is waiting for clients to connect to each other.

Constant Value: 2 (0x00000002)

#### public static final int ROOM_STATUS_INVITING

Constant returned by `getStatus()` indicating that the room has one or more players that have been invited and have not responded yet.

Constant Value: 0 (0x00000000)

#### public static final int ROOM_VARIANT_ANY

Constant used to indicate that the variant for a room is unspecified.

Constant Value: -1 (0xffffffff)

## Public Methods

#### public abstract Bundle getAutoMatchCriteria ()

Retrieves the automatch criteria used to create or join this room, if any. May be null if the room has no automatch properties.

##### Returns

- A bundle containing the automatch criteria for this room.

#### public abstract int getAutoMatchWaitEstimateSeconds ()

Retrieves the estimated wait time for automatching to finish for players who are not automatched immediately, as measured from the time that the room entered the automatching pool.

##### Returns

- The estimated wait time in seconds, or -1 if the room is not automatching or no estimate could be provided.

#### public abstract long getCreationTimestamp ()

##### Returns

- The server timestamp at which the room was created.

#### public abstract String getCreatorId ()

##### Returns

- The ID of the participant who created this Room. Note that not all participants will see the same value for the creator. In the case of an automatch, this value may differ for each participant.

#### public abstract String getDescription ()

##### Returns

- Description of this room.

#### public abstract void getDescription (CharArrayBuffer dataOut)

Loads the room description into the given `CharArrayBuffer`.

##### Parameters

dataOut | The buffer to load the data into.

#### public abstract Participant getParticipant (String participantId)

Get a participant in a room by its ID. Note that the participant ID must correspond to a participant in this match, or this method will throw an exception.

##### Parameters

participantId | Match-local ID of the participant to retrieve status for.

##### Returns

- The participant corresponding to the given ID.

##### Throws

| IllegalStateException} if the participant is not a participant in this match.

#### public abstract String getParticipantId (String playerId)

Get the participant ID for a given player. This will only return a non-null ID if the player is actually a participant in the room and that player's identity is visible to the current player. Note that this will always return non-null for the current player.

##### Parameters

playerId | Player ID to find participant ID for.

##### Returns

- The participant ID corresponding to given player, or null if none found.

#### public abstract ArrayList<String> getParticipantIds ()

Get the IDs of the participants of the given room.

##### Returns

- The IDs of the participants in this room. These are returned in the participant order of the room. Note that these are not stable across rooms.

#### public abstract int getParticipantStatus (String participantId)

Get the status of a participant in a room. Note that the participant ID must correspond to a participant in this room, or this method will throw an exception.

##### Parameters

participantId | Room-local ID of the participant to retrieve status for.

##### Returns

- The current status of the participant in this room. One of `STATUS_INVITED`, `STATUS_JOINED`, `STATUS_DECLINED`, or `STATUS_LEFT`.

##### Throws

| IllegalStateException} if the participant is not a participant in this room.

#### public abstract String getRoomId ()

##### Returns

- The ID of this Room.

#### public abstract int getStatus ()

##### Returns

- The current status of the room. One of `ROOM_STATUS_INVITING`, `ROOM_STATUS_ACTIVE`, `ROOM_STATUS_AUTO_MATCHING`, `ROOM_STATUS_CONNECTING`.

#### public abstract int getVariant ()

##### Returns

- Variant specified for this room, if any. A variant is an optional developer-controlled parameter describing the type of game to play. If specified, this value will be a positive integer. If this room had no variant specified, returns `ROOM_VARIANT_ANY`.