I am having issues in understanding Google Developers Guides:
Google Developers GUIDE Add Leaderboards
I have created a game using LibGDX, so I have a Core module and Android Module. In Android Module I only have AndroidLauncher
Class which extends AndroidApplication
.
public class AndroidLauncher extends AndroidApplication implements ActionResolver, GoogleApiClient.OnConnectionFailedListener{
ActionResolverAndroid actionResolverAndroid;
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
actionResolverAndroid = new ActionResolverAndroid(this);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
initialize(new PepeAdventures(actionResolverAndroid), config);
}
I have created another class in Android module called ActionResolverAndroid
.
public class ActionResolverAndroid implements ActionResolver {
Handler handler;
Context context;
GoogleApiClient client;
public ActionResolverAndroid(Context context){
handler = new Handler();
this.context = context;
client = new GoogleApiClient.Builder(context)
.addApi(Drive.API)
.addScope(Drive.SCOPE_FILE)
.build();
}
}
All this I did according to instruaction (as I understood them) by Google Developers.
Now I have issues:
- How to display LeaderBoards, when it is GameOver ?
In my Core module, I have
GameOverScreen
class which currently pops, when the player dies. Now I would like to post also LeaderBoards. I dont know how to do this.
Google API Client requires Fragment Activity when I try to build it in my ActionResolverAndroid class. But I do not have any FragmentActivity in my Project - what should I pass here?
client = new GoogleApiClient.Builder(context) .enableAutoManage(/*fragmentActivity*/, /*OnConnFailedListener*/) .addApi(Drive.API) .addScope(Drive.SCOPE_FILE) .build();
I also tried to find some other tutorials on how to do this, but all are out-dated or very hard to find (especially when using LibGDX as Project Setup).
Please help me or give me advice on what to do.