Leaderboards and Tournaments Tutorial - Wrap Up
And there you have it, a leaderboard using Leaderboards and Tournaments's APIs in a simple quiz game. The source code will need the following changes before you can run it:
- Update the
TOURNAMENT_IDvariables with valid ids from your game.
- Generating the Leaderboards and Tournaments API with the openapi-codegen tool.
As a next step, you could explore how to add prizes to the game. One approach is to create in-game "trophies" for competition wins. You could check to see if the current player is at the top of the leaderboard in the leaderboard activity. If so, after the tournament closes, the winning player can call Claim Prize. Once the prize is awarded, you could add a trophy icon to the splash screen.
We hope that this tutorial has helped your understanding of how to integrate Leaderboards and Tournaments into your own Android game. All source code for the app is available to download. Please let us know what you think!