Copyright (C) 2013 Google Inc.
TrivialQuestNative: This sample demonstrates how to use the Events and Quests features of Google Play Services. The sample presents a sign in button and four buttons to simulate killing monsters in-game. When you click the buttons, an event is created and sent to Google Play Games to track what the player is doing in game.
When milestones, specified in Quests, are reached in the game, the game will receive a callback with an object describing the Quest reward.
-
Set up the project in Developer Console. For more info:
https://developers.google.com/games/services/console/enabling
Note your package name and the APP ID of the project.
-
Enable Turn-based multiplayer setting in MULTIPLAYER SETTINGS (see the ones that the sample needs in its res/values/ids.xml)
- Start Eclipse
- Import the Google Play Services library project (available for download through the SDK manager):
- Click File | Import | Android | Existing Android Code into Workspace
- Select
SDK/extras/google/google_play_services/google_play_services_lib(whereSDKstands for the path where you installed your Android SDK) - Click Finish
- Import the sample
- Go into the project properties window for that project (right-click, Properties) and check that this project has a reference to the
google_play_services_libproject.
Your project should now compile. However, don't run it yet, since you still need to adjust your game's IDs in order for the sample(s) to work.
Now jump to the Modify IDs, compile and run section and continue to follow the instructions there.
To set up a sample:
- Change the package name from com.google.example.games.* to your own package name (the same one you registered in Developer Console!). To do that, open AndroidManifest.xml and put your package name in the "package" attribute of the manifest tag. You will need to fix some of the references (particularly to the generated R class) because of the package name change. Ctrl+Shift+O in Eclipse (and Alt+Enter in Android Studio) should take care of most of the work.
- Modify res/values/strings.xml and place your IDs there, as given by the
Developer Console (create the leaderboards and achievements necessary for
the sample, if any). Remember that the App ID is only the numerical portion
of your client ID, so use
123456789012and not123456789012.apps.gooogleusercontent.com. - Compile and run.
IMPORTANT: make sure to sign your apk with the same certificate as the one whose fingerprint you configured on Developer Console, otherwise you will see errors.
IMPORTANT: if you are testing an unpublished game, make sure that the account you intend to sign in with (the account on the test device) is listed as a tester in the project on your Developer Console setup (check the list in the "Testing" section), otherwise the server will act as though your project did not exist and return errors.
First of all, take a look at our troubleshooting guide. Most setup issues can be solved by following this guide.
If your question is not answered by the troubleshooting guide, we encourage you to post your question to stackoverflow.com. Our team answers questions there reguarly.