-
-
Notifications
You must be signed in to change notification settings - Fork 20
Amazon GameCircle
Amazon GameCircle is a games service primarily used on Amazon's Fire devices. It is useable on every other Android device, too.
For setting up Amazon GameCircle with your app, you need to upload your signed APK to the Amazon App Store in order to set it up. It does only work with a correctly signed app then.
Amazon GameCircle supports the following features:
- Achievements
- Leaderboards
- Cloud save
Amazon discontinued the social features in December 2017. Therefore, Achievements and Leaderboard Scores are only viewable by the player. In my opinion, this step supersedes these features, so my advice is to use GameCircle only on Amazon's own devices, primarily for cloud save and to get the player's nickname.
According to Amazon's documentation.
Add the dependency to your Android project:
compile "de.golfgl.gdxgamesvcs:gdx-gamesvcs-android-amazongc:$gamesvcsVersion"
You have to use at least gdx-gamesvcs v0.1.1.
Place api_key.txt from GameCircle configuration in android/assets folder. Please note: Unfortunately, api_key.txt for your debug key is different from the one for your release certificate. Deal with it.
Change your AndroidLauncher
to use the GameCircleClient
and initialize it:
GdxGame game = new GdxGameSvcsApp();
GameCircleClient gameCircleClient = new GameCircleClient();
gameCircleClient.setAchievementsEnabled(true).setLeaderboardsEnabled(true);
gameCircleClient.intialize(this);
game.gsClient = gameCircleClient;
initialize(game, config);
Insert the lines that are stated in Step 3 of Amazon's documentation how to initialize GameCircle to your AndroidManifest.xml (don't forget to replace YOUR_PACKAGE_NAME_HERE!). The other steps are not necessary, they are covered by the dependency you've already added. (I noticed that even the documented changes to the AndroidManifest are not necessary, everything works well without the changes. If anyone knows what they are for, please enlighten me)
See sample app's Amazon branch for a full example (AndroidManifest example).
gdx-gamesvcs-amazongc implementation supports the usage of Whispersync, Amazon's cloud storage and sync feature. Just call loadGameState()
and saveGameState()
. Please note that you have to enable this feature by calling setWhisperSyncEnabled
before calling the initialize
method of GameCircleClient
.
(Changed since v0.2.2) Please be aware that gsClientConnected()
is called after a successful initialization of GameCircle, but getPlayerDisplayName()
may still return null
until the asynchronous response on the request for the player's data arrives. When this data is present, gsClientConnected()
is called a second time.
Check if your app was installed via Amazon App Store or runs on an Amazon device.
boolean isAmazonDevice = Build.MANUFACTURER.equalsIgnoreCase("amazon");
final Application application = getApplication();
String installerName = application.getPackageManager().getInstallerPackageName(application.getPackageName());
boolean fromAmazonStore = installerName != null && installerName.equalsIgnoreCase("com.amazon.venezia");