This repository has been archived by the owner on Sep 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Initial setup
alextel69 edited this page Apr 19, 2014
·
1 revision
Your project should be compiled with these SDKs:
- Adobe AIR >= 4.0
- FlexSDK >= 4.6
Add .ane file from "ane-ready-to-use" folder to your project's classpath. It depends on your IDE. Extension id is "com.google.api.games".
Open application.xml. Find <manifestAdditions>
tag. Make following changes to it:
<manifest android:installLocation="auto">
<uses-sdk android:minSdkVersion="9" />
<!--your own additions-->
<application>
<!-- your own additions-->
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ your_game_services_id" />
<meta-data android:name="com.google.android.gms.version" android:value="4242000" />
<activity android:name="com.google.api.games.SignInActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.google.api.games.StubActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<!-- your own additions-->
</application>
</manifest>
Attention:
-
minSdkVersion
should be >= 9 - don't change
installLocation
- your_game_services_id should be replaced with your Game Services id. For example, 881667876962
- your_game_services_id should be preceded by "\ " (slash with space)
This is a startup code:
import com.google.api.games.Games;
Games.initialize();
Games.start();
GameIds.initialize(...);
Full example:
package com.example
{
import com.google.api.games.Games;
import com.google.api.games.GameIds;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
/**
* Document class (app entry point)
*/
public class Main extends Sprite
{
[Embed(source="path/to/game-ids.xml",mimeType="application/octet-stream")]
private static const gameIds:Class;
public function Main()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
// required initialization code
Games.initialize();
// some config commands, for example, Games.promptUserToSignInOnStartup()
Games.start();
GameIds.initialize(new XML(new gameIds())); // initialize your game ids
}
}
}
In order to make calls to Achievements.* and Leaderboards.* methods, you need to obtain achievements and leaderboards id's. They are usually represented by game-ids.xml, which you can download from your Game Services' page.
Whenever you need id, call GameIds.getIdByName(). For example, sample GameIds.getIdByName("super_achievement") will return CgkI4tCAvNQZEAIQAQ
Browse wiki for usage examples & available API