Copyright (c) 2014 Google Inc. All rights reserved.
This sample is exposes the Google Play Game services publishing API as a command line tool.The listing, creation, updating and deletion of achievements and leaderboards is supported, as well as uploading images for them. The authentication can be done via web based OAuth flow, or by using a service account certificate in a .p12 file. The input for creating and updating achievements and leaderboards is a CSV file. The sample code converts the CSV file into the JSON representation required by the API.
To run this sample you need:
- Python version 2.7+.
- Google API Client.
In to install this run:
pip install --upgrade google-api-python-client
Usage information can be viewed by running
python games-config.py --help
python games-config.py achievement list <appId>
where is the numeric application id for your game.
The output is comma separated values (csv) where is one row for each achievement/locale pair. The published data is not shown by default, but can be included by adding the --incPublished option.
python games-config.py achievement get <achievementId>
Note: that the id is the achievement ID, not the application.
- Retrieve the existing achievement list:
python games-config.py achievement list <appId> --outcsv ach_data.csv
- Modify the contents of the file
- Run the update command
python games-config.py achievement update --incsv ach_data.csv
python games-config.py achievement delete <achievementId>
python games-config.py leaderboard list <appId>
where is the numeric application id for your game.
The output is comma separated values (csv) where is one row for each achievement/locale pair. The published data is not shown by default, but can be included by adding the --incPublished option.
python games-config.py leaderboard get <leaderboardId>
Note: that the id is the leaderboard ID, not the application.
- Retrieve the existing achievement list:
python games-config.py leaderboard list <appId> --outcsv lb.csv
- Modify the contents of the file
- Run the update command
python games-config.py leaderboard update --incsv lb.csv
python games-config.py leaderboard delete <leaderboardId>
Images for achievements and leaderboards can be uploaded using:
python games-config.py achievement image <achievementId> --image <filename>
or
python games-config.py leaderboard image <leaderboardId> --image <filename>
The images must comply with the requirements outlined in Icon guidelines.