Home

Awesome

Google Game Services ANE for Android

The Google Game Services AIR native extension allows you to focus on your game logic and easily have access to all the cool features of this great SDK in your AIR games.

NOTICE: Google has discontinued the Game Services Project for iOS. On iOS, you may consider using Firebase

Main Features:

find the latest asdoc for this ANE here.
How to get started? read here

AIR Usage

For the complete AS3 code usage, see the demo project here.

/*
	Before initializing the GameServices ANE, you need to login users using the GoogleSignin ANE
	https://github.com/myflashlab/GoogleSignIn-ANE
*/

// depending on your app design, you must customize the Signin Options
// If you want GoogleGames signin only, do like below:
var options:GSignInOptions = new GSignInOptions();
options.gamesSignIn = true; // set to true if you are working with Google Games Services ANE.

// you don't want to bother users with a permission page, right? so set these to false 
// and don't ask for extra access scopes.
options.requestId = false;
options.requestProfile = false;
options.requestEmail = false;

// IMPORTANT: if you are not using Game Save Snapshots, you would not need GScopes.DRIVE_APPFOLDER
options.requestScopes = [
	"https://www.googleapis.com/auth/games", // must be set for games
	GScopes.DRIVE_APPFOLDER // optional and only needed if you are using Game Save Snapshots
];

// then pass the options to the initialization method of the GSignIn ANE
GSignIn.init(options);

// Finally, add listeners
GSignIn.listener.addEventListener(GSignInEvents.SILENT_SIGNIN_SUCCESS, onSilentSigninSuccess);
GSignIn.listener.addEventListener(GSignInEvents.SILENT_SIGNIN_FAILURE, onSilentSigninFailure);
GSignIn.listener.addEventListener(GSignInEvents.SIGNIN_SUCCESS, onSigninSuccess);
GSignIn.listener.addEventListener(GSignInEvents.SIGNIN_FAILURE, onSigninFailure);
GSignIn.listener.addEventListener(GSignInEvents.SIGNOUT_SUCCESS, onSignoutSuccess);
GSignIn.listener.addEventListener(GSignInEvents.SIGNOUT_FAILURE, onSignoutFailure);

// check if user is already loggedin or not
var account:GAccount = GSignIn.signedInAccount;
if(account)
{
	initGames(); // here, you will initialize the GameServices ANE
}
else
{
	// You should first check if user can signin silently, if she can't, use the signin() method
	GSignIn.silentSignIn();
}

function onSigninSuccess(e:GSignInEvents):void
{
	trace("e.account.scopes: "+ e.account.scopes);
	initGames();
}

function onSilentSigninSuccess(e:GSignInEvents):void
{
	initGames();
}

When user signed in successfully, call Games.init(); to initialize the GameServices ANE. And then listen to GamesEvents.CONNECT_SUCCESS events before calling other methods of this ANE. Make sure you are reading the Wiki to learn how you should use different features of this ANE.

AIR .xml manifest

<!--
	First make sure you have setup the GoogleSignin ANE and you have already added
	the required settings to the manifest.
-->


<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<!-- Optional. Add this if you are using the "Games.metadata.getCurrentAccountName" method -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />

<!-- application ID which identifies your game settings in the Google Game Services console -->
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ 00000000000"/>



<!--
Embedding the ANE:
-->
  <extensions>

        <!-- Embed the GSignIn ANE which is a must for the Games ANE to work -->
        <extensionID>com.myflashlab.air.extensions.google.signin</extensionID>

        <!-- Dependencies required by the GSignIn ANE -->
        <extensionID>com.myflashlab.air.extensions.dependency.overrideAir</extensionID>
        <extensionID>com.myflashlab.air.extensions.dependency.androidx.arch</extensionID>
        <extensionID>com.myflashlab.air.extensions.dependency.androidx.core</extensionID>
        <extensionID>com.myflashlab.air.extensions.dependency.androidx.lifecycle</extensionID>
        <extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.auth</extensionID>
        <extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.base</extensionID>
        <extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.basement</extensionID>
        <extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.tasks</extensionID>

        <!-- gameServices ANE -->
        <extensionID>com.myflashlab.air.extensions.gameServices</extensionID>

        <!-- Dependencies required by the gameServices ANE -->
        <extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.games</extensionID>
        <extensionID>com.myflashlab.air.extensions.dependency.googlePlayServices.drive</extensionID>
        <extensionID>com.myflashlab.air.extensions.dependency.androidx.design</extensionID>

    </extensions>
-->

Requirements

  1. Android API 19+
  2. AIR SDK 33+
  3. implement GoogleSignIn in your app first.

Commercial Version

https://www.myflashlabs.com/product/game-services-air-native-extension/

Game Services ANE

Tutorials

How to embed ANEs into FlashBuilder, FlashCC and FlashDevelop
How to get started with Games Services?

Premium Support

Premium Support package If you are an active MyFlashLabs club member, you will have access to our private and secure support ticket system for all our ANEs. Even if you are not a member, you can still receive premium help if you purchase the premium support package.