Achievements in Android
You can use the Play Games services APIs to unlock and display achievements in your game.
If you haven't already done so, you might find it helpful to review the achievements game concepts.
To unlock an achievement, call the
unlock() method and and pass in the
If the achievement is of the incremental type (that is, several steps are required to
unlock it), call
Games.Achievements.increment(getApiClient(), "my_incremental_achievment_id", 1);
You do not need to write additional code to unlock the achievement; Play Games services automatically unlocks the achievement once it reaches its required number of steps.
A good practice is to define the achievement IDs in the
strings.xml file, so
your game can reference the achievements by resource ID. When making calls to update and load achievements, make sure to also follow these best practices to avoid exceeding your API quota.
To show a player's achievements, call
getAchievementsIntent() to get an
Intent to create the default achievements UI. Your game can then bring up the UI by calling
startActivityForResult. In the following snippet,
REQUEST_ACHIEVEMENTS is an arbitrary integer used as the request code.
An example of the default achievements UI is shown below.