GamesClient
Stay organized with collections
Save and categorize content based on your preferences.
This interface is deprecated.
Consider migrating to the games v2. Refer to the migration
guide
.
A client to interact with games basic functionality.
Public Methods
public abstract Task< Bundle
>
getActivationHint
()
This method is deprecated.
Consider migrating to the games v2. Refer to the migration
guide
.
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 abstract Task< String
>
getAppId
()
This method is deprecated.
Consider migrating to the games v2. Refer to the migration
guide
.
Returns a Task
which
asynchronously loads the application ID linked to this client instance.
public abstract Task< String
>
getCurrentAccountName
()
This method is deprecated.
Consider migrating to the games v2. Refer to the migration
guide
.
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 abstract Task< Intent
>
getSettingsIntent
()
This method is deprecated.
Consider migrating to the games v2. Refer to the migration
guide
.
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.
This method is deprecated.
Consider migrating to the games v2. Refer to the migration
guide
.
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.
This method is deprecated.
Consider migrating to the games v2. Refer to the migration
guide
.
Returns a Task
which
asynchronously sets the View
to use as a
content view for popups.
Parameters
gamesContentView
The view to use as a content view for popups. View cannot be null.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-23 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-23 UTC."],[[["\u003cp\u003e\u003ccode\u003eGamesClient\u003c/code\u003e provides methods to interact with basic Google Play games services functionality.\u003c/p\u003e\n"],["\u003cp\u003eIt allows retrieval of user and application data, such as application ID, current account name, and previous user actions.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can utilize this client to manage the display of game service pop-ups and access the Games Settings screen.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eGamesClient\u003c/code\u003e uses asynchronous tasks (\u003ccode\u003eTask\u003c/code\u003e) to handle operations and return results.\u003c/p\u003e\n"]]],[],null,["# GamesClient\n\npublic interface **GamesClient** \n**This interface is deprecated.** \n\nConsider migrating to the games v2. Refer to the [migration\nguide](//developer.android.com/games/pgs/android/migrate-to-v2#migrate-signin-client).\n\nA client to interact with games basic functionality. \n\n### Public Method Summary\n\n|------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract Task\\\u003c[Bundle](//developer.android.com/reference/android/os/Bundle.html)\\\u003e | [getActivationHint](/android/reference/com/google/android/gms/games/GamesClient#getActivationHint())() *This method is deprecated. Consider migrating to the games v2. Refer to the [migration guide](//developer.android.com/games/pgs/android/migrate-to-v2#migrate-signin-client).* |\n| abstract Task\\\u003c[String](//developer.android.com/reference/java/lang/String.html)\\\u003e | [getAppId](/android/reference/com/google/android/gms/games/GamesClient#getAppId())() *This method is deprecated. Consider migrating to the games v2. Refer to the [migration guide](//developer.android.com/games/pgs/android/migrate-to-v2#migrate-signin-client).* |\n| abstract Task\\\u003c[String](//developer.android.com/reference/java/lang/String.html)\\\u003e | [getCurrentAccountName](/android/reference/com/google/android/gms/games/GamesClient#getCurrentAccountName())() *This method is deprecated. Consider migrating to the games v2. Refer to the [migration guide](//developer.android.com/games/pgs/android/migrate-to-v2#migrate-signin-client).* |\n| abstract Task\\\u003c[Intent](//developer.android.com/reference/android/content/Intent.html)\\\u003e | [getSettingsIntent](/android/reference/com/google/android/gms/games/GamesClient#getSettingsIntent())() *This method is deprecated. Consider migrating to the games v2. Refer to the [migration guide](//developer.android.com/games/pgs/android/migrate-to-v2#migrate-signin-client).* |\n| abstract Task\\\u003c[Void](//developer.android.com/reference/java/lang/Void.html)\\\u003e | [setGravityForPopups](/android/reference/com/google/android/gms/games/GamesClient#setGravityForPopups(int))(int gravity) *This method is deprecated. Consider migrating to the games v2. Refer to the [migration guide](//developer.android.com/games/pgs/android/migrate-to-v2#migrate-signin-client).* |\n| abstract Task\\\u003c[Void](//developer.android.com/reference/java/lang/Void.html)\\\u003e | [setViewForPopups](/android/reference/com/google/android/gms/games/GamesClient#setViewForPopups(android.view.View))([View](//developer.android.com/reference/android/view/View.html) gamesContentView) *This method is deprecated. Consider migrating to the games v2. Refer to the [migration guide](//developer.android.com/games/pgs/android/migrate-to-v2#migrate-signin-client).* |\n\nPublic Methods\n--------------\n\n#### public abstract Task\\\u003c[Bundle](//developer.android.com/reference/android/os/Bundle.html)\\\u003e\n**getActivationHint** ()\n\n**This method is deprecated.** \n\nConsider migrating to the games v2. Refer to the [migration\nguide](//developer.android.com/games/pgs/android/migrate-to-v2#migrate-signin-client). \nReturns a [Task](/android/reference/com/google/android/gms/tasks/Task) which\nasynchronously loads a [Bundle](//developer.android.com/reference/android/os/Bundle.html) that may\ncontain an information regarding to the previous user's action.\n\nThe `Task` returned will not be null, but the `Bundle`\nreturned from the `Task` may be null if it was already received or there is\nno related data found.\n\nUnless a new user action is performed all the subsequent calls will return a\n`Task` with a null `Bundle`.\n\nA `Bundle` can contain the following keys:\n\n- [SnapshotsClient.EXTRA_SNAPSHOT_METADATA](/android/reference/com/google/android/gms/games/SnapshotsClient#EXTRA_SNAPSHOT_METADATA) if the user wanted to resume a saved game. The value contained here is a [SnapshotMetadata](/android/reference/com/google/android/gms/games/snapshot/SnapshotMetadata) object which can be accessed with [Bundle.getParcelable(String)](//developer.android.com/reference/android/os/Bundle.html#getParcelable(java.lang.String)). \n\n#### public abstract Task\\\u003c[String](//developer.android.com/reference/java/lang/String.html)\\\u003e\n**getAppId** ()\n\n**This method is deprecated.** \n\nConsider migrating to the games v2. Refer to the [migration\nguide](//developer.android.com/games/pgs/android/migrate-to-v2#migrate-signin-client). \nReturns a [Task](/android/reference/com/google/android/gms/tasks/Task) which\nasynchronously loads the application ID linked to this client instance. \n\n#### public abstract Task\\\u003c[String](//developer.android.com/reference/java/lang/String.html)\\\u003e\n**getCurrentAccountName** ()\n\n**This method is deprecated.** \n\nConsider migrating to the games v2. Refer to the [migration\nguide](//developer.android.com/games/pgs/android/migrate-to-v2#migrate-signin-client). \nReturns a [Task](/android/reference/com/google/android/gms/tasks/Task) which\nasynchronously loads the name of the currently selected account. This is the account\nthe user has chosen to use for Google Play Games.\n\nThe returned `Task` can fail with a [RemoteException](//developer.android.com/reference/android/os/RemoteException.html).\n\nNote that your app must have `\u003cuses-permission\nandroid:name=\"android.permission.GET_ACCOUNTS\" /\u003e` declared in your manifest\nin order to use this method. Otherwise the `Task` will fail with\n[SecurityException](//developer.android.com/reference/java/lang/SecurityException.html). \n\n#### public abstract Task\\\u003c[Intent](//developer.android.com/reference/android/content/Intent.html)\\\u003e\n**getSettingsIntent** ()\n\n**This method is deprecated.** \n\nConsider migrating to the games v2. Refer to the [migration\nguide](//developer.android.com/games/pgs/android/migrate-to-v2#migrate-signin-client). \nReturns a [Task](/android/reference/com/google/android/gms/tasks/Task) which\nasynchronously loads an [Intent](//developer.android.com/reference/android/content/Intent.html) to\nshow the Settings screen that allows the user to configure Games-related features for\nthe current game. Note that this must be invoked with [Activity.startActivityForResult(Intent, int)](//developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent,%20int)), so that the identity of the\ncalling package can be established.\n\nThe returned `Task` can fail with a [RemoteException](//developer.android.com/reference/android/os/RemoteException.html).\n\nMost applications will not need to call this directly, since the Settings UI is\nalready reachable from most other Games UI screens (achievements, leaderboards, etc.)\nvia a menu item. \n\n#### public abstract Task\\\u003c[Void](//developer.android.com/reference/java/lang/Void.html)\\\u003e **setGravityForPopups** (int gravity)\n\n**This method is deprecated.** \n\nConsider migrating to the games v2. Refer to the [migration\nguide](//developer.android.com/games/pgs/android/migrate-to-v2#migrate-signin-client). \nReturns a [Task](/android/reference/com/google/android/gms/tasks/Task) which\nasynchronously sets the part of the screen at which games service pop-ups (for example,\n\"welcome back\" or \"achievement unlocked\" popups) will be displayed using gravity.\n\nDefault value is [Gravity.TOP](//developer.android.com/reference/android/view/Gravity.html#TOP)\\|[Gravity.CENTER_HORIZONTAL](//developer.android.com/reference/android/view/Gravity.html#CENTER_HORIZONTAL). \n\n##### Parameters\n\n| gravity | The gravity which controls the placement of games service pop-ups. |\n|---------|--------------------------------------------------------------------|\n\n#### public abstract Task\\\u003c[Void](//developer.android.com/reference/java/lang/Void.html)\\\u003e **setViewForPopups** ([View](//developer.android.com/reference/android/view/View.html) gamesContentView)\n\n**This method is deprecated.** \n\nConsider migrating to the games v2. Refer to the [migration\nguide](//developer.android.com/games/pgs/android/migrate-to-v2#migrate-signin-client). \nReturns a [Task](/android/reference/com/google/android/gms/tasks/Task) which\nasynchronously sets the [View](//developer.android.com/reference/android/view/View.html) to use as a\ncontent view for popups. \n\n##### Parameters\n\n| gamesContentView | The view to use as a content view for popups. View cannot be null. |\n|------------------|--------------------------------------------------------------------|"]]