-
-
Notifications
You must be signed in to change notification settings - Fork 20
Google Play Games
Google Play Games is a games service primarily used on Android devices. It is a must-have for any Android-capable game.
Google Play Games belongs to the Google Play services, so you have to get a Google Developer Account and upload your signed APK to the Play Store in order to set it up. It does only work with a correctly signed app then.
Google Play Games supports the following features:
- Achievements
- Leaderboards
- Events
- Cloud save
- Real time and turn based multiplayer
Configure the project like expained in step 2 of Google's Getting started tutorial.
Add the dependency to your Android project:
compile "de.golfgl.gdxgamesvcs:gdx-gamesvcs-android-gpgs:$gamsvcsVersion"
Note that this dependency declares dependency to play services libraries. You can override the version with Gradle project properties, if needed.
Add the following lines to your AndroidManifest.xml and insert the following lines:
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="@string/app_id" />
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>
Of course then you need to add your App ID from the Developer Console in your res/value/strings.xml:
<string name="app_id">yourAppIdHere</string>
Change your AndroidLauncher
to use the GpgsClient
and initialize it:
GdxGame game = new GdxGameSvcsApp();
game.gsClient = new GpgsClient().initialize(this, false);
initialize(game, config);
Don't forget to inform the gpgsClient about activity callbacks. Add the following to your AndroidLauncher
:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
gpgsClient.onGpgsActivityResult(requestCode, resultCode, data);
}
(work in progress!)