我尝试在我的LibGDX游戏中实现Google Play游戏服务器。如果我开始我的游戏它的工作是10秒,但在这10个Sek我的游戏崩溃后,我不知道为什么。我希望你能提供帮助。
这是代码
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");
}
}
答案 0 :(得分:0)
在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)
还要检查我的问题和答案。 Maybie你会发现一些有用的东西: link