GamesClient

public interfaceGamesClient

A client to interact with games basic functionality.

Public Method Summary

abstractTask<Bundle>
getActivationHint()
Returns aTask which asynchronously loads aBundle that may contain an information regarding to the previous user's action.
abstractTask<String>
getAppId()
Returns aTask which asynchronously loads the application ID linked to this client instance.
abstractTask<String>
getCurrentAccountName()
Returns aTask which asynchronously loads the name of the currently selected account.
abstractTask<Intent>
getSettingsIntent()
Returns aTask which asynchronously loads anIntent to show the Settings screen that allows the user to configure Games-related features for the current game.
abstractTask<Void>
setGravityForPopups(int gravity)
Returns aTask 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.
abstractTask<Void>
setViewForPopups(View gamesContentView)
Returns aTask which asynchronously sets theViewto use as a content view for popups.

Public Methods

public abstractTask<Bundle> getActivationHint()

Returns aTaskwhich asynchronously loads aBundlethat may contain an information regarding to the previous user's action.

TheTaskreturned will not be null, but theBundle returned from theTaskmay 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 Taskwith a nullBundle.

ABundlecan contain the following keys:

public abstractTask<String> getAppId()

Returns aTaskwhich asynchronously loads the application ID linked to this client instance.

public abstractTask<String> getCurrentAccountName()

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

The returnedTaskcan fail with aRemoteException.

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 theTaskwill fail with SecurityException.

public abstractTask<Intent> getSettingsIntent()

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

The returnedTaskcan fail with aRemoteException.

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.

public abstractTask<Void>setGravityForPopups(int gravity)

Returns aTaskwhich 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 isGravity.TOP|Gravity.CENTER_HORIZONTAL.

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

public abstractTask<Void>setViewForPopups(View gamesContentView)

Returns aTaskwhich asynchronously sets theViewto use as a content view for popups.

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