Setting Up Google Play Games Services

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 a game project for your game and specify details such as the name and description of the game.
  • Create and link the necessary credentials to authorize and authenticate your game to Google Play Games Services.

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:

  1. Create a game in Play Console if you haven't already. See here for more details.
  2. Navigate to Grow > Play Games Services > Setup and management > Configuration.
  3. Specify which Play Games services project you want to use, either create one from scratch, or choose to use an existing one.

    • Create new Play Games services project: In order to create Play Games service project, a cloud project is required.

      • If you already have a cloud project created for this game, select your cloud project from dropdown list and select Use.

      • Otherwise select Create new cloud project, follow the instructions to create a new cloud project for this game. Then select Refresh cloud projects, select the newly created cloud project from the dropdown list and click Use.

    • Use an existing Play Games services project: If you are creating a new game in Play Console to change the existing package name, or if you have free and paid versions of your game with different package names you can use this option. Choose the Play Games services project then click on Use.

  4. A Play Games Services game project is created, and Play Games Services APIs are automatically enabled in the selected cloud project.

  5. In the Properties section, you can select Edit Properties and 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 match what you have set up for your game's Play Store listing.
    • For guidelines on creating the graphic assets, see the Google Play for Developers guide and the Google Play Featured-Image Guidelines.

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 a credential for Play Games Services, which is the association between a client ID and your game, use Google Cloud Platform to create the client ID. Then, use Google Play Console to add a credential, linking the client ID to your game.

For more detailed instructions, see the following steps:

If you haven't yet configured the OAuth consent screen, the Credentials section will display a message prompting you to configure.

Prompt to configure OAuth consent screen

Click Configure. This opens a dialog with further instructions and a deep link to the Google Cloud Platform.

Configure your OAuth consent screen. Configure and publish your OAuth consent screen setup page in Google Cloud platform. 1. Go to the OAuth consent screen setup page in Google Cloud Platform. 2. Make the consent screen available for everyone on Google Play (externally), or only to people in your organization (internally). 3. Provide an application name - this must match the name of your game in Play Console. 4. Add the scopes: games, games_lite, and drive.appdata. 5. Publish your consent screen. 6. Return to Play Console to confirm configuration.

If you have completed the setup of the OAuth consent screen, click Done. Google Play Console refreshes automatically, and if configuration was successful you will be able to create a credential:

Creating a credential

b. Create a credential

In order to authorize your game to communicate with Google Play games services, you must create a credential with an authorized OAuth2 client ID.

In the Credentials section, click Add credential.

In the wizard, choose whether you want to create an Android credential (if your game APK will authenticate the user and use PGS APIs) or a game server credential (if your game server will use PGS APIs). Follow the instructions specific to your desired credential type.

Android

Set up credential details

Ensure that the name in the Name field matches the name of your game. Choose whether to enable Anti-Piracy.

Set up authorization

Next, choose an OAuth client ID to use for this game project. If you already have OAuth2 client IDs, you can choose one. However, you will usually create a new one. Click Create OAuth client. This opens a dialog with deep links and instructions for creating an OAuth Client ID in Google Cloud Platform.

  1. Select Android as the application type.
  2. Enter your game's name in the Name field.
  3. Enter your Android application's package name in the Package name field.
  4. Open a terminal and run the Keytool utility to get the SHA1 fingerprints of the release and debug certificates.

    To get the release certificate fingerprint, run the following command:

    keytool -list -keystore <path-to-production-keystore> -v

    To get the debug certificate fingerprint, run the following command:

    keytool -list -keystore <path-to-debug-keystore> -v

  5. The keytool utility 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.

  6. Paste the SHA1 fingerprint into the Signing certificate fingerprint (SHA1) field.

  7. Click Create.

For more information about OAuth 2.0 on Android, see Authenticating to OAuth2 Services.

After you click Done in the dialog, the available Client IDs will refresh. Choose the credential you created from the drop-down menu and then click Save Changes. This creates the credential as a draft, enabling you to authenticate to Play Games Services in your game.

You may want to create two credentials: one with the release certificate fingerprint, and one 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 Sign your app.

Game server

Set up credential details

Ensure that the name in the Name field matches the name of your game.

Set up authorization

Next, choose an OAuth client ID to use for this game project. If you already have OAuth2 client IDs, you can choose one. However, you will usually create a new one. Click Create OAuth client. This opens a dialog with deep links and instructions for creating an OAuth Client ID in Google Cloud Platform.

  1. Select Web application as the application type.
  2. Enter your game's name in the Name field.
  3. Click Create.

For more information about OAuth 2.0 on Android, see Authenticating to OAuth2 Services.

After you click Done in the dialog, the available Client IDs will refresh. Choose the credential you created from the drop-down menu and then click Save Changes. This creates the credential as a draft, enabling you to authenticate to Play Games Services from your game server. For more information about using Play Games Services with your game server, see Enabling Server-Side Access to Google Play Games Services.

Avoiding common setup problems

To avoid common setup mistakes, make sure to follow these recommendations when setting up your game to use 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 Cloud 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 must create a credential using the Oauth 2.0 client ID as described in Create a credential.
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. The application ID can be found at the top of the Configuration page and is labeled as Project ID below the name of your game.
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. Publish the consent screen in Google Cloud Platform
Before publishing the app in the Google Play Console, publish the consent screen in Google Cloud Platform. Without this step, the public audience won’t be able to use any of the Play Games Services features.
7. 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:

Next steps

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 your unpublished Play Games Services game project 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 features for your game, such as leaderboards and achievements. To learn more, see Enable features.