Adobe AIR & GameCircle: Build and Test Your App

Introduction

This page describes how to build and test your GameCircle AIR ANE app. You’ll need to take these steps:

  • Update your application descriptor.
  • Add your API key file (Android only).

Update Your Application Descriptor

You’ll need to be using the AIR SDK version 4.0 or higher, include the extension in your Application Descriptor XML, and update the Android Manifest Additions with GameCircle-specific data. For a working example, see the file example-src/app.xml.

  • Set your AIR SDK to 4.0 or higher in the app descriptor file:
      <application  xmlns="http://ns.adobe.com/air/application/4.0">
  • Include a link to the extension in the descriptor:
      <extensionID>com.amazon.extensions.GameCircle</extensionID>
  • For Android, update your Android Manifest Additions as shown below. Replace “com.company.game” with your own application ID. Notice that the value of android:host is your application ID with an “air.” prefix. The AIR SDK adds this prefix to your package/bundle identifier. If you omit the “air.” prefix, your app won’t initialize.
      <android>
        <manifestAdditions><![CDATA[
            <manifest  android:installLocation="auto">
            <uses-permission  android:name="android.permission.INTERNET"/>
            <uses-permission  android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
            <uses-permission  android:name="android.permission.ACCESS_NETWORK_STATE"/>
            <application>
              <activity
                android:name="com.amazon.ags.html5.overlay.GameCircleUserInterface"
                android:theme="@style/GCOverlay"
                android:hardwareAccelerated="false">
              </activity>
              <activity
                android:name="com.amazon.ags.html5.overlay.GameCircleAlertUserInterface"
                android:theme="@style/GCAlert"
                android:hardwareAccelerated="false">
              </activity>
              <activity
                android:name="com.amazon.identity.auth.device.authorization.AuthorizationActivity"
                android:theme="@android:style/Theme.NoDisplay"
                android:allowTaskReparenting="true"
                android:launchMode="singleTask">
                <intent-filter>
                  <action  android:name="android.intent.action.VIEW" />
                  <category  android:name="android.intent.category.DEFAULT" />
                  <category  android:name="android.intent.category.BROWSABLE" />
                  <data  android:host="air.com.company.name" android:scheme="amzn"  />
                </intent-filter>
              </activity>

              <receiver
                android:name="com.amazon.identity.auth.device.authorization.PackageIntentReceiver"
                android:enabled="true">
                <intent-filter>
                  <action  android:name="android.intent.action.PACKAGE_INSTALL" />
                  <action  android:name="android.intent.action.PACKAGE_ADDED" />
                  <data  android:scheme="package" />
                </intent-filter>
              </receiver>
            </application>
          </manifest>
        ]]></manifestAdditions>
      </android>

Add Your API Key File

When building with the AIR extension and targeting Android, you’ll need an API key for each version of your game. API keys are generated as part of your GameCircle configuration, using the GameCircle Developer Console.

To generate an API key for an AIR project:

  1. Before you can generate an API key, you need some information from your app:
    • The application ID, which may be a package name or bundle ID
    • (Android only) the MD5 signature for the app’s certificate
    • (Android only) the SHA-256 signature for the app’s certificate

    AIR APKs are signed with a .p12 cert file, so for Android apps you need to get the MD5 and SHA-256 signatures for the .p12 cert file used to sign the APK.

    • If you don’t already have a .p12 cert file, you can use this keytool command to generate one (this process may take a while):

    keytool -genkeypair -keystore <your keystore name>.p12 -validity 10000 -keyalg RSA -keysize 2048 -storetype PKCS12

    You’ll be prompted for a password and asked a series of questions.

    • Once you have a .p12 cert file, extract the MD5 and SHA-256 signatures:

      keytool -list -v -keystore <your keystore name>.p12 -storetype PKCS12 -storepass <password>

  2. Go to the GameCircle Developer Console, and open the configuration you want to use with this app. If you haven’t yet created a configuration, see the page Creating a GameCircle Configuration for more info.
  3. Go to API Keys, step 2 in the workflow.
  4. Click Generate an API Key for the platform you’re developing for and enter the following information:
    • API key name: This value is pre-filled based on the configuration name. You can change it, but the name must be unique.
    • Package name/BundleID: This is the application ID for your project. with the “air.” prefix. This prefix is automatically added by the AIR SDK, so if your package name is “com.company.game”, you’ll need to enter “air.com.company.game”.
    • Signature: (Android only) This is the SHA-256 signature, retrieved from the .p12 file for your app.

    Once you’ve generated an API key, you can download it to an apikey.txt file.

To add an API key to your AIR project:

Flash Professionals:

  1. On the File menu, click AIR for Android Settings.
  2. Under Included Files, add api_key.txt.

Flash Builder 4.7

  1. Drag the file api_key.txt into your project.
  2. Select Project > Properties > ActionScript Build Packaging > Google Android.
  3. Ensure the checkbox for api_key.txt is selected.