Trivial Quest 2
This sample demonstrates how to use the Event-and-Quest feature of Google Play Game Services. In this sample, the game displays a sign-in button, along with four colored buttons. Clicking each button causes the application to send an event to Google Play Game Services ("GPGS"), enabling GPGS to track the player's progress toward a milestone.
When the player reaches a milestone specified in a Quest, the game receives a callback with an object describing the Quest reward.
Follow these steps to set up the sample:
- Update the package name in
AndroidManifest.xmlto be something other than
- Modify your app folder structure to match your package name.
- Replace the package name in
MainActivity.java. The package name must be unique; otherwise, the API console cannot link your app correctly.
- Create your project in the Google Play Developer Console.
- Link your app.
- Copy the
APP IDfrom the console into
- Set up four events in the console. As you create each event,
copy its identifier into
- If you are using Android Studio, resync gradle, and build the TrivialQuest 2
Running the Sample
- Press the Run button in Android Studio, and select a target device. When the app starts, the Play Games UI appears.
- Sign in to the app. The application toasts a message with the events and their current counts.
- In the application, click the Quests button to show current quests.
Creating and completing Quests
- Create a Quest in the Google Play Developer Console, setting a date range that includes the current date.
- Accept the Quest in the app.
- Complete the Quest.
- A toast appears showing the Quest reward (as JSON data, for example).