Getting Started

Before you begin

  • You should have your Android development environment set up.
  • You should have a physical device running Android 2.3  or higher for testing.

Step 1:  Download SDK and prepare your device

To install the Google Play services SDK for development:

  1. Launch the SDK Manager.
    1. On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory.
    2. On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android SDK, then execute android sdk.
  2. Install the Google Play services SDK.
  3. Scroll to the bottom of the package list, expand Extras, select Google Play services, and install it.
  4. The Google Play services SDK is saved in your Android SDK environment at <android-sdk>/extras/google/google_play_services/.
  5. Install a compatible version of the Google APIs platform.
  6. If you want to test your app on the emulator, expand the directory for Android 4.2.2 (API 17) or a higher version, select Google APIs, and install it. Then create a new AVD with Google APIs as the platform target.
  7. Note: Only Android 4.2.2 and higher versions of the Google APIs platform include Google Play services.

Step 2: Setup the game in the Developer Console

The Google Play Developer Console is where you manage game services for your game and configure metadata for authorizing and authenticating your game.

To set up the sample game in the Developer Console:

  1. Point your web browser to the Developer Console and sign in. If you haven't registered for the Developer Console before, you will be prompted to do so.
  2. Follow these instruction to add your game to the Developer Console.
    1. When asked if you use Google APIs in your app, select I don’t use any Google APIs in my game yet.
    2. For the purpose of this training, you can fill up the form with your own game details. For convenience, you can use the placeholder icons and screenshots provided in the Downloads page.
    3. Follow these instructions to generate an OAuth 2.0 client ID for your Android app.
    4. When linking your Android app, make sure to specify the exact package name you used previously when renaming sample package.
    5. You can use the Unity to generate a new Keystore and signed certificate if you don’t have one already. To learn how to generate a new Keystore and signed certificate, see Compile and sign with Unity.
  3. Make sure to record the following information for later:
    1. Your application ID: This is a string consisting only of digits (typically 12 or more), at the beginning of your client ID.
    2. Your signing certificate: Note which certificate you used when setting up your API access (the certificate whose SHA1 fingerprint you provided). You should use the same certificate to sign your app when testing or releasing your app.
  4. Configure achievements for your game:
    1. Select the Achievements tab in the Developer Console.
    2. Add the  achievements:
    3. Record the IDs (long alphanumeric strings) for each achievement that you created.
    4. Configure achievements that are appropriate for your game. To learn more, see the concepts behind achievements.
  5. Configure the leaderboards:
    1. Select the the Leaderboards tab in the Developer Console.
    2. Add  leaderboards.
    3. Record the IDs (long alphanumeric strings) for each leaderboard you created.
    4. Configure leaderboards that are appropriate for your game. To learn more, see the concepts behind leaderboards.
  6. Add test accounts for your game. This step is needed only for apps that have not yet been published in the Developer Console. Before the app is published, only the test accounts listed in the Developer Console can log in. However, once an application is published, everyone is allowed to log in.

Step 3: Prepare Resources

To run the game, you need to configure the application ID as a resource in your Android project. You will also need to add games metadata in the AndroidManifest.xml. Open Assets/Plugins/Android/AN_Res/res/values/ids.xml

and replace the placeholder IDs.

  1. Specify your application ID in the app_id resource.
  2. Specify each achievement ID that you created earlier in the corresponding achievement_* resource.
  3. Specify each leaderboard ID that you created earlier in the corresponding leaderboard_* resource.

Step 4: Test your game

To ensure that game services are functioning correctly in your game, test the application before you publish it on Google Play. You can get started from plugin play service example scenes, but do not forget to updated example variables with your project values.

Note: It's recommended that you test on a physical Android device. However, if you do not have a physical device, you can test against the Android Emulator. To do so, download the emulator system image that includes the Google Play Services, under Android 4.2.2, from the SDK Manager.

To run your game on your physical test device:

  1. Verify that you have set up the test account that you are using to login to the app (as described in Step 2).
  2. Export an APK and sign it with the same certificate that you used to set up the project in Developer Console.
  3. Install the signed APK on your physical test device.


After all preparation is ready, you can start using playing. The API usage guidelines will be described in the next articles of this chapter. Or you can start with Playmaker actions.