This document covers how to use the Google Play Console to set up Google Play games services for your Android game. The Google Play Console provides a centralized place for you to manage game services and configure metadata for authorizing and authenticating your game.
To add your game to the Google Play Console, follow these general steps:
- Create an entry for your game and specify details such as the name and description of the game.
- In order for your game to access Google APIs, you must provide the necessary credentials to authorize and authenticate your game.
These steps are covered in more detail in the sections below.
Step 1. Sign in to the Google Play Console
To sign in, go the Google Play Console. If you haven't registered for the Google Play Console before, you will be prompted to do so.
Step 2. Add your game to the Google Play Console
To add your game, follow these steps:
- Open the Game Services page, select the Google Play games services tab on the left, then click the Add New Game button.
Specify if the game you are adding already uses Google APIs.
- If this is a game you are creating from scratch, or you have never set up Google APIs for it previously, stay on the I don't use any Google APIs in my game yet tab. Enter your game's name and assign it a category, and then click the Continue button.
- If this is a game for which you have already set up one or more Google APIs, select the I already use Google APIs in my game tab. You will see a list of projects from the Google API Console for which you are listed as a developer. Select your project from this list, assign the game a category, then click the Continue button.
In the Game Details form, add the description, category, and graphic assets for your game.
- Only the display name is required for testing. The other fields must be filled out before you can publish your game.
- The display name and description for your game should be generic enough to apply across all versions of your game that share the same Google Play games services.
- For guidelines on creating the graphic assets, see the Google Play for Developers guide and the Google Play Featured-Image Guidelines.
Click Save to create a new entry for your game in the Google Play Console. A corresponding entry in the Google API Console is also created for you.
Step 3. Generate an OAuth 2.0 client ID
Your game must have an OAuth 2.0 client ID in order to be authenticated and authorized to call the Google Play games services. To set up the association between a client ID and your game, use the Google Play Console to generate the client ID and link it to your game.
To generate an OAuth 2.0 client ID for your game, follow these steps:
a. Create a linked application
To link your game to a Google API Console project, open the Linked apps page, and then follow the instructions specific to your platform.
- Click the Android button.
- The application name may be shown to your players, so specify a name that closely matches the name of your actual Android game.
- Add the application's package name.
- Select whether or not to turn on Anti-Piracy.
- Click Save and continue, then follow the steps in the Create a client ID section below.
- Click the Web button.
- The application name may be shown to your players, so specify a name that closely matches the name of your actual web game.
- Add the URL to launch your game.
- Click Save and continue, then follow the steps in the Create a client ID section below.
b. Create a client ID
- In the Step 2: Authorize your app screen, click the Authorize your app now button to begin the process of creating an OAuth 2.0 client ID.
- You will be prompted to enter a package name. This information will appear in the OAuth 2.0 permissions dialog box when a user is asked to authorize your game. Your game name is placed in the project name field by default.
- Click Continue, then follow the steps in the Specify client ID settings section below.
c. Specify client ID settings
Next, specify your client ID settings by following the instructions specific to your platform.
- Choose Installed application as your Application type and select Android as the installed application type (these should be your only options).
- In the Package name field, enter your Android application's package name.
- Open a terminal and run the
Keytool utility to get the SHA1 fingerprint of the certificate. You should
get both the release and debug certificate fingerprints.
To get the release certificate fingerprint:
keytool -list -keystore <path-to-production-keystore>To get the debug certificate fingerprint:
keytool -list -keystore <path-to-debug-keystore>
- The keytool prompts you to enter a password for the keystore. The
default password for the debug keystore is
android. The keytool then prints the fingerprint to the terminal.
- Paste the SHA1 fingerprint into the Signing certificate fingerprint (SHA1) field.
- Click the Create client button, then follow the steps in the Gather credentials for authentication and authorization section below.
For more information about OAuth 2.0 on Android, see Authenticating to OAuth2 Services.
You should create two client IDs, one with the release certificate fingerprint and another with the debug certificate fingerprint. Make sure to use the same package name for both. This allows Google Play games services to recognize calls from your linked APKs that are signed with either certificate. For more information about certificate signing for Android, see Signing Your Application.
You can add more than one Android app to the same game entry in Google Play Console. However, this should only be done if there are different versions of the same game (for example, the free version and the paid version). In this case, always list the paid version before the free version (or the full version before the demo/trial version). Do not link different games to the same project as this may cause incorrect behavior. Instead, create a separate game entry in the Google Play Console for each game that you publish.
- Choose Web application as your Application type (it should be the only option).
- Enter the site or host name where you will be hosting your app. You can add additional sites later.
- Click Create client, then follow the steps in the Gather credentials for authentication and authorization section below.
d. Gather credentials for authentication and authorization
Depending on the platform you are developing for, you may need to locate and record the following credential information.
After you click the Create Client button, you should see your new client ID for this application. Make a note of the client ID, as you will need this information later. You will have a different client ID for each platform.
You can always find this information later by revisiting the Linked Apps page and clicking on the linked application associated with the client ID for your platform.
The client ID is listed at the bottom of the page.
You may also need to know your application ID to properly set up sign in. You can find this by looking for the 12-or-13-digit number next to your game's display name at the top of the page.
e. (Optional) Creating multiple client IDs
If you are creating a game that runs on multiple platforms, you will need to create a separate client ID for each platform. To do this, click the Link another app button on the Linked apps page and repeat the steps starting from the Create a linked application section.
Avoiding common setup problems
To avoid common setup mistakes, make sure to follow these recommendations when setting up your game to use the Google Play games services.
- 1. Set up your game with the Google Play Console
- If you created an Oauth 2.0 client ID for your app in the Google Play Console,
Google Play games services will not know about the association between the
game’s achievement and leaderboards and the client ID. To create this
association, you should first link your app with the game as described in
Create a linked application.
- 2. Use the correct application ID in Android
- The application ID is a required string resource that you must reference in your Android manifest. The application ID string consists only of the digits (typically 12 or more) at the beginning of the client ID provided by the Google Play Console. To learn how to find the application ID, see Application ID.
- 3. Sign your APK with the correct certificate
- When linking your Android app to your game in the Google Play Console, you must use exactly the same package name and certificate fingerprint that you used to publish your app. If there is a mismatch, calls to Google Play games services will fail. You should create two client IDs, one with the release certificate fingerprint and another with the debug certificate fingerprint, and use the same package name for both. To learn more about how to specify the signing certificate in the Google Play Console, see Signing Your Applications.
- 4. When developing for Android, include the Play Games SDK as a library project, not as a standalone JAR
- Make sure that the Google Play services SDK is referenced as a library project in your Android project, otherwise this could lead to errors when your app is unable to find Google Play services resources. To learn how to set up your Android project to use Google Play services, see Setting Up Google Play Services.
- 5. Sign in with a tester account during development
- If you have not published your game setting changes in the Google Play Console, you might encounter errors during testing if you are not signed in with a whitelisted tester account. You should always enable your Google Play Console publisher account for testing. To learn how to manage tester accounts, see Enabling accounts for testing.
- 6. At release, publish the Play Games services settings first before you publish your game
- Developers might accidentally publish their app without publishing the corresponding Google Play games services settings for their app. This might cause players who are signing in with non-tester accounts to encounter errors since the app cannot reference the correct game settings. When releasing your game, remember to first publish your game settings by using the Publish Game option in the Google Play Console. To learn how to publish your changes, see Publishing your game changes.
For additional tips, refer to these related resources:
- Top 7 Google Play games services setup mistakes - Video that describes common Google Play games services setup pitfalls and scenarios.
- Android troubleshooting guide - Developer documentation that describes how to troubleshoot issues while developing Android games.
Before proceeding further, you should add test accounts to your game as described in Enabling accounts for testing. Users with authorized test accounts will have access to to your unpublished game in Google Play, and can test that your configured Google Play games services are working correctly.
Once you have completed the initial setup tasks described above, you can proceed to configure Google Play games services for your game, such as leaderboards and achievements. To learn more, see Configuring Play Games.