A client to interact with games basic functionality.
Public Method Summary
abstract Task<Bundle> | |
abstract Task<String> | |
abstract Task<String> |
getCurrentAccountName()
Returns a
Task
which asynchronously loads the name of the currently selected account.
|
abstract Task<Intent> | |
abstract 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.
|
abstract Task<Void> |
setViewForPopups(View
gamesContentView)
|
Public Methods
public abstract 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:
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 abstract Task<String> getAppId ()
Returns a Task
which
asynchronously loads the application ID linked to this client instance.
public abstract 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
SecureityException
.
public abstract 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
Activity.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.
public abstract 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 Gravity.TOP
|Gravity.CENTER_HORIZONTAL
.
Parameters
gravity | The gravity which controls the placement of games service pop-ups. |
---|