0

I try to implements the Google Play Games Server in my LibGDX Game. If i start my Game it work's 10 Seconds but after this 10 Sek my Game crash and i don't know why. I hope you can help.

Here is the code

import android.os.Bundle;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.games.Games;
import com.google.android.*;
import com.randomsoftwareindustries.bubbleburster.bubbleburster;

public class AndroidLauncher extends AndroidApplication implements GameHelper.GameHelperListener{

GameHelper gameHelper;

@Override
protected void onCreate (Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    config.useAccelerometer = false;
    config.useCompass = false;
    config.useWakelock = true;
    gameHelper = new GameHelper(this,GameHelper.CLIENT_ALL);
    gameHelper.enableDebugLog(true);
    initialize(new LIBGDXGAME(), config);
    gameHelper.setup(this);

}

@Override
public void onStart() {
    super.onStart();
    gameHelper.onStart(this);
}

@Override
public void onStop() {
    super.onStop();
    gameHelper.onStop();
}

@Override
public void onSignInFailed() {
    // TODO Auto-generated method stub
    System.out.println("Sign in failed");
}

@Override
public void onSignInSucceeded() {
    // TODO Auto-generated method stub
    System.out.println("Sign in succeeded");
}

}

wiifree
  • 91
  • 1
  • 10

1 Answers1

0

try with this code in onCreate:

if (gameHelper == null) {
        gameHelper = new GameHelper(this, GameHelper.CLIENT_ALL); //maybie CLIENT_GAMES?
        gameHelper.enableDebugLog(true);
    }
    gameHelper.setup(this);

    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    initialize(new LIBGDXGAME(this), config)

also check my question and answer. Maybie you will find something usefull: link

Community
  • 1
  • 1
raco
  • 398
  • 1
  • 5
  • 18