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.
- Create your project in the Google Play Developer Console and set Saved Games to ON.
- Link your app to the game configuration.
- Set the applicationId in build.gradle to the package name configured in the Google Play Developer Console.
- 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.
If you are encountering errors such as:
{statusCode=INTERNAL_ERROR, resolution=null}
You may need to manually enable the Drive API from the [Google API Console] (https://console.developers.google.com/) or may need to enable the saved games feature from the Play Games Developer Console.