TurnBasedMatchEntity | Android Developers

Quicknav Quicknav
Links

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

Android Sites

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

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Inherited Constants | Fields | Inherited Fields | Methods | Inherited Methods | [Expand All]
public final class

# TurnBasedMatchEntity

extends Object
implements SafeParcelable TurnBasedMatch

java.lang.Object
↳ | com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatchEntity

## Class Overview

Data object representing the data for a turn-based match. This is immutable, and therefore safe to cache or store. Note, however, that the data it represents may grow stale.

This class exists solely to support parceling these objects and should not be used directly.

## Summary

[Expand] Inherited Constants
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |
From interface com.google.android.gms.common.internal.safeparcel.SafeParcelable
String | NULL |
From interface com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch
int | MATCH_STATUS_ACTIVE | Constant returned by `getStatus()` indicating that the match has started.
int | MATCH_STATUS_AUTO_MATCHING | Constant returned by `getStatus()` indicating that one or more slots are waiting to be filled by auto-matching.
int | MATCH_STATUS_CANCELED | Constant returned by `getStatus()` indicating that the match was canceled by one of the participants.
int | MATCH_STATUS_COMPLETE | Constant returned by `getStatus()` indicating that the match has finished.
int | MATCH_STATUS_EXPIRED | Constant returned by `getStatus()` indicating that the match expired.
int | MATCH_TURN_STATUS_COMPLETE | Turn status constant for matches which have been completed.
int | MATCH_TURN_STATUS_INVITED | Turn status constant for matches which the current player has been invited to.
int | MATCH_TURN_STATUS_MY_TURN | Turn status constant for matches where it is the current player's turn.
int | MATCH_TURN_STATUS_THEIR_TURN | Turn status constant for matches where it is not the current player's turn.
int | MATCH_VARIANT_DEFAULT | Constant used to indicate that the variant for a match is unspecified.

Fields
public static final TurnBasedMatchEntityCreator | CREATOR |

[Expand] Inherited Fields
From interface com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch
public static final int[] | MATCH_TURN_STATUS_ALL | Array of all the turn status constants.

Public Methods
boolean | canRematch() Return whether or not this match can be rematched.
int | describeContents()
boolean | equals(Object obj)
TurnBasedMatch | freeze() Freeze a volatile representation into an immutable representation.
Bundle | getAutoMatchCriteria() Retrieves the automatch criteria used to create or join this match, if any.
int | getAvailableAutoMatchSlots() Return the maximum number of available automatch slots for this match.
long | getCreationTimestamp()
String | getCreatorId()
byte[] | getData() Return the current (game-specific) data for this match.
String | getDescription()
void | getDescription(CharArrayBuffer dataOut) Loads the match description into the given `CharArrayBuffer`.
Participant | getDescriptionParticipant() Get the participant representing the primary opponent in the match.
String | getDescriptionParticipantId() Get the ID of another participant in the match that can be used when describing the participants the user is playing with.
Game | getGame()
long | getLastUpdatedTimestamp() Return the timestamp at which the match was last modified.
String | getLastUpdaterId() Return the ID of the participant who updated the match most recently.
String | getMatchId()
int | getMatchNumber() Return the match sequence number for this match.
Participant | getParticipant(String participantId) Get a participant in a match by its ID.
String | getParticipantId(String playerId) Get the participant ID for a given player.
ArrayList<String> | getParticipantIds() Get the IDs of the participants of the given match.
int | getParticipantStatus(String participantId) Get the status of a participant in a match.
ArrayList<Participant> | getParticipants() Retrieve the `Participant`s for this object.
String | getPendingParticipantId() Return the ID of the participant that is considered pending.
byte[] | getPreviousMatchData() Return the match data from the previous match, if available.
String | getRematchId() Return the match ID of the rematch that was created from this match, if any.
int | getStatus()
int | getTurnStatus()
int | getVariant()
int | getVersion() Return the current version of the match.
int | hashCode()
boolean | isDataValid() Check to see if this object is valid for use.
boolean | isLocallyModified() Return whether or not this match has been locally modified.
String | toString()
void | writeToParcel(Parcel out, int flags)

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
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.
From interface com.google.android.gms.games.multiplayer.turnbased.TurnBasedMatch
abstract boolean | canRematch() Return whether or not this match can be rematched.
abstract Bundle | getAutoMatchCriteria() Retrieves the automatch criteria used to create or join this match, if any.
abstract int | getAvailableAutoMatchSlots() Return the maximum number of available automatch slots for this match.
abstract long | getCreationTimestamp()
abstract String | getCreatorId()
abstract byte[] | getData() Return the current (game-specific) data for this match.
abstract String | getDescription()
abstract void | getDescription(CharArrayBuffer dataOut) Loads the match description into the given `CharArrayBuffer`.
abstract Participant | getDescriptionParticipant() Get the participant representing the primary opponent in the match.
abstract String | getDescriptionParticipantId() Get the ID of another participant in the match that can be used when describing the participants the user is playing with.
abstract Game | getGame()
abstract long | getLastUpdatedTimestamp() Return the timestamp at which the match was last modified.
abstract String | getLastUpdaterId() Return the ID of the participant who updated the match most recently.
abstract String | getMatchId()
abstract int | getMatchNumber() Return the match sequence number for this match.
abstract Participant | getParticipant(String participantId) Get a participant in a match 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 match.
abstract int | getParticipantStatus(String participantId) Get the status of a participant in a match.
abstract String | getPendingParticipantId() Return the ID of the participant that is considered pending.
abstract byte[] | getPreviousMatchData() Return the match data from the previous match, if available.
abstract String | getRematchId() Return the match ID of the rematch that was created from this match, if any.
abstract int | getStatus()
abstract int | getTurnStatus()
abstract int | getVariant()
abstract int | getVersion() Return the current version of the match.
abstract boolean | isLocallyModified() Return whether or not this match has been locally modified.

## Fields

#### public static final TurnBasedMatchEntityCreator CREATOR

## Public Methods

#### public boolean canRematch ()

Return whether or not this match can be rematched. This will return true when the match has complete and has not already been rematched.

##### Returns

- Whether or not this match can be rematched.

#### public int describeContents ()

#### public boolean equals (Object obj)

#### public TurnBasedMatch freeze ()

Freeze a volatile representation into an immutable representation. Objects returned from this call are safe to cache.

Note that the output of `freeze` may not be identical to the parent object, but should be equal. In other words:

     Freezable f1 = new Freezable();
     Freezable f2 = f1.freeze();
     f1 == f2 may not be true.
     f1.equals(f2) will be true.

##### Returns

- A concrete implementation of the data object.

#### public Bundle getAutoMatchCriteria ()

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

##### Returns

- A bundle containing the automatch criteria for this match.

#### public int getAvailableAutoMatchSlots ()

Return the maximum number of available automatch slots for this match. If automatch criteria were not specified during match creation, or if all slots have been filled, this will return 0.

##### Returns

- The maximum number of additional players that can be added to this match.

#### public long getCreationTimestamp ()

#### public String getCreatorId ()

#### public byte[] getData ()

Return the current (game-specific) data for this match.

##### Returns

- Byte array representing the current (game-specific) match state data.

#### public String getDescription ()

#### public void getDescription (CharArrayBuffer dataOut)

Loads the match description into the given `CharArrayBuffer`.

##### Parameters

dataOut | The buffer to load the data into.

#### public Participant getDescriptionParticipant ()

Get the participant representing the primary opponent in the match.

##### Returns

- The participant representing the primary opponent in the match.

#### public String getDescriptionParticipantId ()

Get the ID of another participant in the match that can be used when describing the participants the user is playing with. For example, in a four player match this might be used to state "Martha (and 2 others)".

##### Returns

- The participant ID of the primary opponent in the match.

#### public Game getGame ()

#### public long getLastUpdatedTimestamp ()

Return the timestamp at which the match was last modified.

##### Returns

- The server timestamp at which the match was last modified.

#### public String getLastUpdaterId ()

Return the ID of the participant who updated the match most recently.

##### Returns

- The ID of the last participant who updated this Match object.

#### public String getMatchId ()

#### public int getMatchNumber ()

Return the match sequence number for this match. This number starts at 1, and increases every time a rematch is created.

##### Returns

- The match sequence number for this match.

#### public Participant getParticipant (String participantId)

Get a participant in a match 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.

#### public 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 match 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 ArrayList<String> getParticipantIds ()

Get the IDs of the participants of the given match.

##### Returns

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

#### public int getParticipantStatus (String participantId)

Get the status of a participant in a match. 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 current status of the participant in this match. One of `STATUS_INVITED`, `STATUS_JOINED`, `STATUS_DECLINED`, `STATUS_LEFT`, or `STATUS_NOT_INVITED_YET`.

#### public ArrayList<Participant> getParticipants ()

Retrieve the `Participant`s for this object. This is a list of all Participants applicable to the given object.

##### Returns

- A list of `Participant`s for this object.

#### public String getPendingParticipantId ()

Return the ID of the participant that is considered pending. If no participant is considered pending (ie, the match is over, etc), this function will return null.

##### Returns

- The ID of the participant that is considered pending, if any. Returns null if no participant is pending.

#### public byte[] getPreviousMatchData ()

Return the match data from the previous match, if available. Note that this is only provided on the first turn of a rematched match.

##### Returns

- Byte array of data from the previous match of a rematch, or null if not available.

#### public String getRematchId ()

Return the match ID of the rematch that was created from this match, if any. This will only be non-null if a rematch has been created.

##### Returns

- The match ID of the rematch, or null if no rematch exists.

#### public int getStatus ()

#### public int getTurnStatus ()

#### public int getVariant ()

#### public int getVersion ()

Return the current version of the match.

##### Returns

- The current version of the match.

#### public int hashCode ()

#### public boolean isDataValid ()

Check to see if this object is valid for use. If the object is still volatile, this method will indicate whether or not the object can be safely used. The output of a call to `freeze()` will always be valid.

##### Returns

- whether or not the object is valid for use.

#### public boolean isLocallyModified ()

Return whether or not this match has been locally modified. If this is true, the local device has match state which has not successfully synced to the server yet. In this state, further mutations to the match will fail with a status of `STATUS_MATCH_ERROR_LOCALLY_MODIFIED`.

##### Returns

- Whether this match has local modifications or not.

#### public String toString ()

#### public void writeToParcel (Parcel out, int flags)