GamesClient

public class GamesClient extends GoogleApi<Games.GamesOptions>

A client to interact with games basic functionality.

Public Method Summary

Task<Bundle>
getActivationHint()
Returns a Task which asynchronously loads a Bundle that may contain an information regarding to the previous user's action.
Task<String>
getAppId()
Returns a Task which asynchronously loads the application ID linked to this client instance.
Task<String>
getCurrentAccountName()
Returns a Task which asynchronously loads the name of the currently selected account.
Task<Intent>
getSettingsIntent()
Returns a Task which asynchronously loads an Intent to show the Settings screen that allows the user to configure Games-related features for the current game.
Task<Void>
setGravityForPopups(int gravity)
Returns a Task which asynchronously sets the part of the screen at which games service pop-ups (for example, "welcome back" or "achievement unlocked" popups) will be displayed using gravity.
Task<Void>
setViewForPopups(View gamesContentView)
Returns a Task which asynchronously sets the View to use as a content view for popups.

Inherited Method Summary

Public Methods

public Task<Bundle> getActivationHint ()

Returns a Task which asynchronously loads a Bundle that may contain an information regarding to the previous user's action.

The Task returned will not be null, but the Bundle returned from the Task may be null if it was already received or there is no related data found.

Unless a new user action is performed all the subsequent calls will return a Task with a null Bundle.

A Bundle can contain the following keys:

public Task<String> getAppId ()

Returns a Task which asynchronously loads the application ID linked to this client instance.

Required Scopes: SCOPE_GAMES_LITE

public Task<String> getCurrentAccountName ()

Returns a Task which asynchronously loads the name of the currently selected account. This is the account the user has chosen to use for Google Play Games.

The returned Task can fail with a RemoteException.

Note that your app must have <uses-permission android:name="android.permission.GET_ACCOUNTS" /> declared in your manifest in order to use this method. Otherwise the Task will fail with SecurityException.

public Task<Intent> getSettingsIntent ()

Returns a Task which asynchronously loads an Intent to show the Settings screen that allows the user to configure Games-related features for the current game. Note that this must be invoked with startActivityForResult(Intent, int), so that the identity of the calling package can be established.

The returned Task can fail with a RemoteException.

Most applications will not need to call this directly, since the Settings UI is already reachable from most other Games UI screens (achievements, leaderboards, etc.) via a menu item.

Required Scopes: SCOPE_GAMES_LITE

public Task<Void> setGravityForPopups (int gravity)

Returns a Task which asynchronously sets the part of the screen at which games service pop-ups (for example, "welcome back" or "achievement unlocked" popups) will be displayed using gravity.

Default value is TOP|CENTER_HORIZONTAL.

Required Scopes: SCOPE_GAMES_LITE

Parameters
gravity The gravity which controls the placement of games service pop-ups.

public Task<Void> setViewForPopups (View gamesContentView)

Returns a Task which asynchronously sets the View to use as a content view for popups.

Required Scopes: SCOPE_GAMES_LITE

Parameters
gamesContentView The view to use as a content view for popups. View cannot be null.