Huawei Developers
Published in

Huawei Developers

Huawei IAP for libGDX Games

Hi folks! In this guide I’ll explain how to integrate the Huawei IAP with GDX-Pay, a libGDX extension library for IAP.

What’s GDX-Pay?
GDX-Pay is a libGDX extension that aims to provide a cross-platforms API
for IAP.
It supports the following platforms:
• Google Play;
• Apple App Store;
• Amazon App Store;
• Huawei App Gallery (starting from version 1.2.0, but I suggest to use the 1.3.0-SNAPSHOT version)

For further information, please visit: https://github.com/libgdx/gdx-pay

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

Preparation
• Create an app in AppGallery Connect.
• 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:

• Enable the IAP Api service on AGC Console (Manage APIs)

  • Add IAP products on AGC console

Finally coding!

Gradle:
implementation "com.badlogicgames.gdxpay:gdx-pay-android-huawei:1.3.0-SNAPSHOT"

Now, in your Activity extending the AndroidApplication class (a libGDX class), You have to instantiate the HuaweiPurchaseManager, like this:

The following are all the action that You can do with the HuaweiPurchaseManager:

Official GDX-Pay-Huawei Example project here:

THANKS!
Bye Folks :}

--

--

--

As Huawei Developers, our Medium publication where we share information about the use of Huawei Ecosystem

Recommended from Medium

Handling configuration changes using static references

droidcon Americas: A Sneak Peek!

How to Create a Hello World Application With Spring Boot

Write a Custom Gradle Plug-In for Your Android App (Part 1)

Android App Bundle and Play Instant

Installing apps programmatically in Android 10

ActivityView, advanced way of composing apps

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Francesco Stranieri

Francesco Stranieri

Developer Advocate @HuaweiItalia

More from Medium

Koin Android

Why resizable bitmap created by Android Studio is distorted

Paytm Payment Gateway Integration on Android Studio

Make your app ready for foldable devices