GameRequest | 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: Constants | Inherited Constants | Methods | Inherited Methods | [Expand All]
public interface

# GameRequest

implements Parcelable Freezable<T>

com.google.android.gms.games.request.GameRequest

Known Indirect Subclasses GameRequestEntity
GameRequestEntity | Data object representing the data for a request.

## Class Overview

Data interface for game requests.

## Summary

Constants
int | RECIPIENT_STATUS_ACCEPTED | Constant indicating that the request has been accepted.
int | RECIPIENT_STATUS_PENDING | Constant indicating that the request is still pending.
int | STATUS_ACCEPTED | Constant indicating that this request has been accepted.
int | STATUS_PENDING | Constant indicating that this request has not been acted on yet.
int | TYPE_ALL | Array of all the request type constants.
int | TYPE_GIFT | Request type indicating that the sender is giving something to the recipient.
int | TYPE_WISH | Request type indicating that the sender is asking for something from the recipient.

[Expand] Inherited Constants
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Public Methods
abstract long | getCreationTimestamp()
abstract byte[] | getData() Retrieves the data associated with the request.
abstract long | getExpirationTimestamp()
abstract Game | getGame() Retrieves the game associated with this request.
abstract int | getRecipientStatus(String playerId) Retrieves the status of the request for a given recipient.
abstract List<Player> | getRecipients() Retrieves the information about all the players that the request was sent to.
abstract String | getRequestId() Retrieves the ID of this request.
abstract Player | getSender() Retrieves the information about the player that sent the request.
abstract int | getStatus() Retrieves the status of the request as an overall status depending on all recipients.
abstract int | getType() Retrieves the type of this request.
abstract boolean | isConsumed(String playerId) Retrieves whether the request was consumed by a specific recipient.

[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.

## Constants

#### public static final int RECIPIENT_STATUS_ACCEPTED

Constant indicating that the request has been accepted.

Constant Value: 1 (0x00000001)

#### public static final int RECIPIENT_STATUS_PENDING

Constant indicating that the request is still pending.

Constant Value: 0 (0x00000000)

#### public static final int STATUS_ACCEPTED

Constant indicating that this request has been accepted. Note - not being returned from server at the moment.

Constant Value: 1 (0x00000001)

#### public static final int STATUS_PENDING

Constant indicating that this request has not been acted on yet.

Constant Value: 0 (0x00000000)

#### public static final int TYPE_ALL

Array of all the request type constants.

Constant Value: 65535 (0x0000ffff)

#### public static final int TYPE_GIFT

Request type indicating that the sender is giving something to the recipient.

Constant Value: 1 (0x00000001)

#### public static final int TYPE_WISH

Request type indicating that the sender is asking for something from the recipient.

Constant Value: 2 (0x00000002)

## Public Methods

#### public abstract long getCreationTimestamp ()

##### Returns

- The server timestamp (in milliseconds from epoch) at which this request was created.

#### public abstract byte[] getData ()

Retrieves the data associated with the request.

##### Returns

- The data associated with the request.

#### public abstract long getExpirationTimestamp ()

##### Returns

- The server timestamp (in milliseconds from epoch) at which this request will expire.

#### public abstract Game getGame ()

Retrieves the game associated with this request.

##### Returns

- The associated game.

#### public abstract int getRecipientStatus (String playerId)

Retrieves the status of the request for a given recipient.

##### Parameters

playerId | The player ID for which the consumed state should be queried.

##### Returns

- The status of this request for a recipient. One of `RECIPIENT_STATUS_ACCEPTED` or `RECIPIENT_STATUS_PENDING`.

#### public abstract List<Player> getRecipients ()

Retrieves the information about all the players that the request was sent to.

##### Returns

- The players that are receiving the request.

#### public abstract String getRequestId ()

Retrieves the ID of this request.

##### Returns

- The request ID.

#### public abstract Player getSender ()

Retrieves the information about the player that sent the request.

##### Returns

- The player that sent the request.

#### public abstract int getStatus ()

Retrieves the status of the request as an overall status depending on all recipients.

##### Returns

- The status of this request. Either `STATUS_ACCEPTED` or `STATUS_PENDING`.

#### public abstract int getType ()

Retrieves the type of this request.

##### Returns

- The type of this request. One of `TYPE_GIFT` or `TYPE_WISH`.

#### public abstract boolean isConsumed (String playerId)

Retrieves whether the request was consumed by a specific recipient.

##### Parameters

playerId | The player ID for which the consumed state should be queried.

##### Returns

- True if the request was consumed by the given recipient.