0

I'm trying to enable Google Play Games in my Adobe Air game for Android. There are 2 apps a full and a demo one. But it looks like SignIn/SubmitScore/ReportAchievement codes are just being ignored, for both apps.

I'm using this ANE, but have also tried this and it's original fork. For all the result is the same. Code "ignored", nothing happens.

My project setup:

  • All the project was done, compiled and packaged in FlashDevelop. Platform is Air Mobile 14.0, SDK is Adobe Air 16.0. I use my own .p12 certificate for Android package, one for each App version.
  • I include the ANE on FlashDevelop the same way I included Game Center ANE, for the same APP. The Game Center one is working, so I think this one should also be fine.
  • I have added my com.google.android.gms.games.APP_ID to the xml, together with the additions required by the ANE.

In my code I do (and nothing happens, no callback is called, no signal is triggered, no sign in pop up screen, but my "trace" notification is shown, so the code is reached):

Games.initialize();
addListeners(); //Adding SignIn and SignOut callbacks

Games.promptUserToSignInOnStartup(true);
Games.start();
NotificationSystem.notifyLoading("Connecting to Google Play Games Service");

On Google's Developer Console:

  • Both apps are published for Alpha/Beta tests, there is no Production version yet.
  • I've set up Play Games Services, it is "Ready to test".
  • Both apps have been linked to it and authorized. I verified OAuth2.0 SHA1 fingerprint for both .p12 and they match.

This is my APK's AndroidManifest.xml, as I can't imagine the problem being on code side, or Google's console side.. I think it should be somewhere on ANE's config when packaging. So it might be here:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="air.mygame">
<application android:hardwareAccelerated="false" android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:configChanges="keyboardHidden|orientation|screenSize" android:label="@string/app_name" android:launchMode="singleTask" android:name=".AppEntry" android:screenOrientation="user" android:theme="@style/Theme.NoShadow" android:windowSoftInputMode="adjustResize|stateHidden">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
        <meta-data android:name="namespaceVersion" android:value="14.0"/>
        <meta-data android:name="aspectRatio" android:value="portrait"/>
        <meta-data android:name="autoOrients" android:value="true"/>
        <meta-data android:name="fullScreen" android:value="true"/>
        <meta-data android:name="uniqueappversionid" android:value="251bf45a-b5b6-49ae-bb1a-4337f47f8f34"/>
        <meta-data android:name="initialcontent" android:value="mygame.swf"/>
        <meta-data android:name="containsVideo" android:value="false"/>
    </activity>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="MY_APP_ID_ON_GOOGLE_PLAY_GAMES"/>
<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"/>
</manifest>
Mattos
  • 11
  • 2
  • Have you checked that you've included the com.google.android.gms and com.google.api.games libraries in the gradle build script? – Aster Apr 08 '15 at 06:11
  • I did include com.google.api.games but com.google.android.gms shouldn't be necessary I think.. But I might have found a problem on the Manifest file, I will try to solve it and if it doesn't work I will do what you said. Thanks for the tip – Mattos Apr 08 '15 at 15:00

1 Answers1

1

Ok! I found the error and it was indeed in the AndroidManifest.xml.

For anyone else struggling with this, the problem is that when working with Adobe Air we don't edit AndroidManifest.xml file directly, we edit application.xml using the manifestAdditions tag. And the needed additions were going to the wrong place.

My application.xml was like:

<android>
   <manifestAdditions>
      <![CDATA[<manifest android:installLocation="auto">
         <uses-permission android:name="android.permission.INTERNET" />
         <uses-permission android:name="android.permission.WAKE_LOCK" />
         <uses-sdk android:minSdkVersion="9" />
         <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
         <!-- GooglePlay Games Services -->
         <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ MY_GOOGLE_PLAY_GAMES_APP_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" />
      </manifest>]]>
   </manifestAdditions>
</android>

Looking at Google's guide there could be no activity tag outside of the application tag on the final AndroidManifest.xml. Also, according to this, the meta-data tag should also be inside the application tag.

I just had to edit the application.xml so it looked like:

<android>
   <manifestAdditions>
      <![CDATA[<manifest android:installLocation="auto">
         <uses-permission android:name="android.permission.INTERNET" />
         <uses-permission android:name="android.permission.WAKE_LOCK" />
         <uses-sdk android:minSdkVersion="9" />
         <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
         <!-- GooglePlay Games Services -->
         <application> <!-- This will be merged with application tag in the final manifest file -->
            <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ MY_GOOGLE_PLAY_GAMES_APP_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" />
         </application>
      </manifest>]]>
   </manifestAdditions>
</android>

To open your final AndroidManifest.xml, file for checking, you can use apktool.

Mattos
  • 11
  • 2