A client to interact with games basic functionality.
Public Method Summary
abstractTask<Bundle> | |
abstractTask<String> | |
abstractTask<String> |
getCurrentAccountName()
Returns a
Task
which asynchronously loads the name of the currently selected account.
|
abstractTask<Intent> | |
abstractTask<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.
|
abstractTask<Void> |
setViewForPopups(View
gamesContentView)
|
Public Methods
public abstractTask<Bundle> getActivationHint()
Returns aTask
which
asynchronously loads aBundle
that may
contain an information regarding to the previous user's action.
TheTask
returned will not be null, but theBundle
returned from theTask
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 nullBundle
.
ABundle
can contain the following keys:
SnapshotsClient.EXTRA_SNAPSHOT_METADATA
if the user wanted to resume a saved game. The value contained here is aSnapshotMetadata
object which can be accessed withBundle.getParcelable(String)
.
public abstractTask<String> getAppId()
Returns aTask
which
asynchronously loads the application ID linked to this client instance.
public abstractTask<String> getCurrentAccountName()
Returns aTask
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 returnedTask
can 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 theTask
will fail with
SecurityException
.
public 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. Note that this must be invoked with
Activity.startActivityForResult(Intent, int)
,so that the identity of the
calling package can be established.
The returnedTask
can 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 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.
Default value isGravity.TOP
|Gravity.CENTER_HORIZONTAL
.
Parameters
gravity | The gravity which controls the placement of games service pop-ups. |
---|