GameManager  |  API reference  |  Android Developers


public final class GameManager
extends Object



The GameManager allows system apps to modify and query the game mode of apps.

Note: After Build.VERSION_CODES.VANILLA_ICE_CREAM, some devices that do not support the GameManager features may not publish a GameManager instance. These device types include:

Therefore, you should always do a null check on the return value of Context.getSystemService(Class) and Context.getSystemService(String) when trying to obtain an instance of GameManager on the aforementioned device types.

Summary

Constants

int GAME_MODE_BATTERY

Battery game mode will save battery and give longer game play time.

int GAME_MODE_CUSTOM

Custom game mode that has user-provided configuration overrides.

int GAME_MODE_PERFORMANCE

Performance game mode maximizes the game's performance.

int GAME_MODE_STANDARD

Standard game mode means the platform will use the game's default performance characteristics.

int GAME_MODE_UNSUPPORTED

Game mode is not supported for this application.

Public methods

int getGameMode()

Return the user selected game mode for this application.

void setGameState(GameState gameState)

Called by games to communicate the current state to the platform.

Inherited methods

From class java.lang.Object

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Constants

GAME_MODE_BATTERY

public static final int GAME_MODE_BATTERY

Battery game mode will save battery and give longer game play time.

Constant Value: 3 (0x00000003)

GAME_MODE_CUSTOM

public static final int GAME_MODE_CUSTOM

Custom game mode that has user-provided configuration overrides.

Custom game mode is expected to be handled only by the platform using users' preferred config. It is currently not allowed to opt in custom mode in game mode XML file nor expected to perform app-based optimizations when activated.

Constant Value: 4 (0x00000004)

GAME_MODE_PERFORMANCE

public static final int GAME_MODE_PERFORMANCE

Performance game mode maximizes the game's performance.

This game mode is highly likely to increase battery consumption.

Constant Value: 2 (0x00000002)

GAME_MODE_STANDARD

public static final int GAME_MODE_STANDARD

Standard game mode means the platform will use the game's default performance characteristics.

Constant Value: 1 (0x00000001)

GAME_MODE_UNSUPPORTED

public static final int GAME_MODE_UNSUPPORTED

Game mode is not supported for this application.

Constant Value: 0 (0x00000000)

Public methods

setGameState

public void setGameState (GameState gameState)

Called by games to communicate the current state to the platform.

Parameters
gameState GameState: An object set to the current state.
This value cannot be null.