I would like to use achievement and leaderboards from Google Play Game Services API in my LibGDX Android Game. The only thing I've achieved is getting examples from Game Services developer website running. I've been trying to use this code in my project for many days and I still got nothing. I've also tried to follow this tutorial http://helios.hud.ac.uk/u1070589/blog/?p=202 but I don't have "main game class (the one that extends from ApplicationListener)" which is required in step 7. I've got only
This is onCreate method from MainActivity.java
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
thingy=this;
RelativeLayout layout=new RelativeLayout(this);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
View gameView=initializeForView(new DogeJump(this),false);
adView=new AdView(this,AdSize.IAB_MRECT,"ca-app-pub-XXXXXXX363095/9011689567");
adView.loadAd(new AdRequest());
layout.addView(gameView);
RelativeLayout.LayoutParams adParams=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
adParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
layout.addView(adView,adParams);
setContentView(layout);
//initialize(new DogeJump(this),false);
}
Off the top of my head, Game class should implement ApplicationListener
, so the class you're missing to follow the tutorial should be DogeJump
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With