README.md

GameServices | Google Play and Game Center extension for Adobe AIR

GameServices extension enables access to achievements and leaderboards functionality provided by Google Play on Android and Game Center on iOS. Achievements can be a great way to increase your users' engagement within your game, while leaderboards can drive competition among your players.

API Overview

Start by initializing the extension using the init method. The only argument is a Boolean that controls whether extension logs show up.

var showLogs:Boolean=false;
GameServices.init( showLogs );

Note that a silent authentication will be performed during initialization. You may add the following event listeners before calling the init method to be notified in case the user has been authenticated silently:

Achievements

To access the achievements API, use the achievements getter. The returned object provides number of methods allowing you to work with player achievements.

Loading Achievements

To load current player's progress in all achievements, use the load method. If successful, the event's achievements property will contain a list of GSAchievement objects. Use these objects to learn about player's progress or build your own UI:

Update Progress

To record an achievement progress, use one of the methods listed below. Note that iOS supports only the setProgress method, where the progress parameter is a percentage value that states how far the player has progressed on the given achievement. Each method dispatches either UPDATE_SUCCESS or UPDATE_ERROR event.

GameServices.achievements.addEventListener( GSAchievementEvent.UPDATE_SUCCESS, onAchievementUpdateSuccess );
GameServices.achievements.addEventListener( GSAchievementEvent.UPDATE_ERROR, onAchievementUpdateError );// Android only
GameServices.achievements.setSteps( "achievementId", 5 );// Set to the given number of steps
GameServices.achievements.increment( "achievementId", 5 );// Increment by the given number of steps// iOS only
GameServices.achievements.setProgress( "achievementId", 55 );// 55% progress

Alternatively, you may report progress on multiple achievements using the report method: