Note: Please be sure to refer to pages 406 through 411 before proceeding. These instructions assume that you already have the Google Play Services SDK and the BaseGameUtils libaries downloaded, and that you have an existing Ellio application uploaded onto your Developer Console.

To test the Ellio Sample with Google Play Game Services, you must follow the following steps:

I. Setting Up a Game Service in the Google Play Developer Console

1. Add the game service to your developer console. Fill in a Display name and Description as desired. Category should be Arcade.

2. Link the Ellio application to your game service. See pages 410-411 to determine your SHA fingerprint. If you add your application using the debug fingerprint, the Play Game Services will only work when you run your game using Eclipse. If you, on the other hand, add your application using the release fingerprint, the Play Game Services will only work when you install your app as using the exported APK.

2. Add a leaderboard. Configure it as you deem fit. It should be a numerical leaderboard.

3. To publish a Game Service, you must add at least five achievements. Since this is a simple demo of the leaderboard, you can just add five dummy achievements that we will never unlock as shown below. If you need a 512×512 icon, download one here. (Right click, save link as).

Once you have created your Game Service, you need to take note of two values.

A. The App ID (an example is shown below):

id\

B. The Leaderboard ID (example shown below):

leaderboard

II. Setting Up the Game Project in Eclipse

1. Download the Sample Ellio Project with Google Play Game Services integration. This includes a README.txt detailing the changes made to the code (since adding music and fixing bugs in Chapter 10).

Click Here to Download

2. Change the package name for the application to match the one that is uploaded in your Developer Console.

2. Open res/values/id.xml and update the app_id to that found in your Google Play listing (See I. A above).

3. Inside GameMainActivity, change the value of the String LEADERBOARD_ID (“THIS_VALUE_NEEDS_TO_BE_CHANGED”) to the key for your leaderboard (See I. B above).

 

Now your application will be able to communicate with your registered Game Service.

A.If you registered your application using the debug keystore’s SHA fingerprint, simply run your project as an Android application in Eclipse to test your leaderboard.

B. If you registered your application using the release keystore’s SHA fingerprint, export your project as an APK file and install it on your device to test your leaderboard.

III. Common Configuration Issues and Solutions

If your application crashes or gives you errors, please check the LogCat listings to determine your issue. Some common configuration issues are listed below.

1. The BaseGameUtils projects gives you errors.

Ensure that the Google Play Services SDK is installed and imported into your package explorer. Then, right click on your BaseGameUtils project, Properties > Android, and remove all libraries referenced in the Library section as shown below.

libraries

 

Next, click Add and select the google-play-services-lib library project inside your Package Explorer. Your errors should be gone.