Huawei Game Service for libGDX games

Francesco Stranieri
Huawei Developers
Published in
3 min readAug 4, 2020

Hi folks! In this guide I’ll explain how to integrate the Huawei Game Service with gdx-gamesvcs, a libGDX extension library for Game Services.

What’s gdx-gamesvcs?
gdx-gamesvcs is a libGDX extension that aims to provide a cross-platforms API
for Game Services.
It supports the following services:
• Google Play Games;
• Apple Game Center;
• GameJolt;
• Amazon GameCircle;
• Kongregate;
• Huawei Game Service (starting from version 1.1.0-SNAPSHOT version)

For further information, please visit: https://github.com/MrStahlfelge/gdx-gamesvcs

Huawei Game Service for libGDX
It supports the following features:
- Account Kit: login, logout;
- Game Service: player info, achievements, leaderboards, game events;
- Drive Kit: save, load and delete data on Cloud

Requirements
• EMUI 3.0+ / Android 4.4+
• HMS Core 4.0.0.300+
• Android Studio 3.0+

Preparation
• Create an app in AppGallery Connect. The app type must be Game.
• Create a libGDX project.
• Generate a signature certificate.
• Generate a signature certificate fingerprint.
• Configure the signature certificate fingerprint.
• Add the app package name and save the configuration file.
• Configure the Maven repository address and AppGallery Connect gradle
plug-in.
• Configure the signature file in Android Studio.

For further information, please visit: https://developer.huawei.com/consumer/en/codelab/HMSPreparation/index.html#0

  • Enable the Account Kit API, Game Service and, if You need to save data on cloud, so also enable Drive Kit API on AGC Console (Manage APIs)
  • (Optional) if You want to save data on Cloud, You have to set a Data Storage location inside the project information on AGC Console
  • (Optional) create some achievements
  • (Optional) create some game events
  • (Optional) create some leaderboards

Finally coding!

Gradle:
implementation “de.golfgl.gdxgamesvcs:gdx-gamesvcs-android-huawei:1.1.0-SNAPSHOT”

Now, in your Activity extending the AndroidApplication class (a libGDX class), optionally implementing the IGameServiceListener (to listen events), You have to instantiate the HuaweiGameServicesClient, and then manage the lifecycle events. Like this:

So? Unleash the power of the HuaweiGameServiceClient!

Do You want moaAAaaRrRr? Read my article about Huawei IAP for libGDX:

THANKS!
Bye Folks :}

--

--