Skip to content Skip to sidebar Skip to footer

Libgdx Game Using Google Play Game Services On Ios And Android

I am creating a game using Libgdx and would like to integrate player, Leaderboard, high score on both iOS and Android devices. Ideally I would use Google Play Game Services but I c

Solution 1:

You don't have to use the REST API for this, even though that would certainly be an option.

The easier way is the use of platform specific code via interfacing.

Everything that is not directly integrated into libGDX won't work via "write once, run everywhere". This also applies to achievements, leaderboards and other things that Google Play Game Services offer. However, you are lucky that GPGS unites these features within one framework for at least Android, iOS and Web.

So what you would do, is adding the platform specific library dependencies to the platform specific projects you have generated. Then implement a generic interface, e. g. AchievementHandler with methods like unlockAchievement(String achievementId).

Then you would implement this interface via AndroidAchievementHandler that makes use of GPGS. The same will work with an IOSAchievementHandler.

In your core code, you will only use AchievementHandler and each platform will use its own implementation of this.

Post a Comment for "Libgdx Game Using Google Play Game Services On Ios And Android"