Skip to content

Commit

Permalink
Merge pull request #896 from eiriksm/play_services_java_fixes
Browse files Browse the repository at this point in the history
Call the lua callback from the java side, add default (required) variables for google play services.
  • Loading branch information
makotok committed Apr 16, 2014
2 parents 51258e4 + 52e23de commit 1d013d4
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions ant/host-source/d.run-host.sh
Expand Up @@ -96,6 +96,7 @@
}

fr $out_dir/project/res/values/strings.xml @NAME@ "$app_name"
fr $out_dir/project/res/values/strings.xml @APP_ID@ "$app_id"

cp -f host-source/project/.project $out_dir/project/.project
fr $out_dir/project/.project @NAME@ "$project_name"
Expand Down
3 changes: 3 additions & 0 deletions ant/host-source/d.settings-global.sh
Expand Up @@ -13,6 +13,9 @@
project_name="untitled"
app_name="untitled"

# If you are using google play services, change this value.
app_id="000"

#----------------------------------------------------------------#
# version numbers
#----------------------------------------------------------------#
Expand Down
5 changes: 4 additions & 1 deletion ant/host-source/source/project/AndroidManifest.xml
Expand Up @@ -45,6 +45,9 @@
</activity>

<receiver android:name="com.ziplinegames.moai.MoaiLocalNotificationReceiver"></receiver>
<!-- Used for google play services. You MUST set your app id in res/values/strings.xml -->
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />

<!-- EXTERNAL DECLARATIONS: Placeholder (DO NOT MOVE OR REMOVE) -->

Expand All @@ -67,4 +70,4 @@

<uses-feature android:name="android.hardware.screen.landscape" android:required="true" />
<uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="true" />
</manifest>
</manifest>
1 change: 1 addition & 0 deletions ant/host-source/source/project/res/values/strings.xml
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">@NAME@</string>
<string name="app_id">@APP_ID@</string>
</resources>
Expand Up @@ -41,6 +41,8 @@ public class MoaiGooglePlayServices {
private static int sServicesStatus;
private static String sToken = null;

protected static native void AKUNotifyConnectionComplete ();

public static final int ALERT_DIALOG_REQUEST_CODE = 7007;
public static final int ACCOUNT_PICKER_REQUEST_CODE = 7117;
public static final int AUTH_REQUEST_CODE = 7227;
Expand Down Expand Up @@ -106,6 +108,12 @@ public static void onStop () {
sGameClient.disconnect ();
}

public static void connectionComplete() {
synchronized ( Moai.sAkuLock ) {
AKUNotifyConnectionComplete ( );
}
}

//================================================================//
// MoaiGooglePlayServices private functions
//================================================================//
Expand Down Expand Up @@ -242,4 +250,4 @@ public static void unlockAchievement ( String achID ) {
sGameClient.unlockAchievement ( achID );
}
}
}
}
Expand Up @@ -6,6 +6,7 @@

package com.ziplinegames.moai;

import com.ziplinegames.moai.MoaiGooglePlayServices;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
Expand All @@ -25,6 +26,7 @@ public class MoaiPlayServicesCallbacks implements ConnectionCallbacks, OnConnect
public void onConnected ( Bundle connectionHint ) {

MoaiLog.i ( "MoaiPlayServicesCallbacks onConnected" );
MoaiGooglePlayServices.connectionComplete();
}

//----------------------------------------------------------------//
Expand Down
1 change: 1 addition & 0 deletions ant/libmoai/build.sh
Expand Up @@ -234,3 +234,4 @@ echo "$facebook_flags" >> libs/package.txt
echo "$push_flags" >> libs/package.txt
echo "$tapjoy_flags" >> libs/package.txt
echo "$twitter_flags" >> libs/package.txt
echo "$playservices_flags" >> libs/package.txt

0 comments on commit 1d013d4

Please sign in to comment.