Integrating GameSparks into LibGDX (Java)

On this post, I’ll share with you my experience integrating LibGDX and GameSparks, the Backend-as-a-Service with huge adoption among, most commonly, mobile developers.


Baas is great way to engage users and acquire more them (and earn more money) for your games. This brings to your game analytics, push notification, social integration, IAP integrations, achievements, leaderboards an so on. Check more on this image featured by GameSparks:

GameSparks features


After this humble introduction into BaaS, let’s integrate it with LibGDX. For most platforms supported by GameSparks, the configuration is straight-forward, but Java integration is not. So, on a Gradle project, this is how I get it working:

First, on the project build.gradle, include this repository on allprojects part:

maven { url "" }

The final code should looks like this:

allprojects {
    apply plugin: "eclipse"
    apply plugin: "idea"

    version = "1.0"
    ext {
        appName = "Speech Colors"

    repositories {
        maven { url "" }
        maven { url "" }

Next, on project core, add this line:

compile "com.gamesparks.sdk:gamesparks-java-sdk:0.0.+"

It will looks like:

project(":core") {
    apply plugin: "java"

    dependencies {
        compile "com.badlogicgames.gdx:gdx:$gdxVersion"
        compile "com.gamesparks.sdk:gamesparks-java-sdk:0.0.2-SNAPSHOT"

After that, sync gradle project and all things should be fine. You’ll be able to use GameSparks SDK into your project, simply by adding:

GS gs = new GS("API_KEY", "API_SECRET", false, false, new CustomPlatform());
gs.setOnAvailable(new GSEventConsumer<Boolean>() {
   public void onEvent(Boolean available) {
      if(available) {
         //Game Sparks Available!
      } else {
         //Game Sparks Not Available!

The core sdk documentation can be found here: