This sample demonstrates how to use the Snapshots feature to save game data. It signs the user into Google Play Game Services ("GPGS"), synchronizes his or her data from a named Snapshot, and then updates the UI to reflect the game state saved in the Snapshot.
Follow these steps to set up the sample:
- Update the package name in
AndroidManifest.xmlto be something other thancom.google.example.games.catt2. - Modify your app folder structure to match your package name.
- Replace the package name in
MainActivity.java. Note that 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 intoCollectAllTheStars/values/ids.xml.
- Sign in. Upon success, the Play Games toast appears.
- Make changes to the game state by selecting stars.
- Sign out. The game UI resets.
- Sign back in with your account. The game UI reflects the saved game state.