Easily integrate Huawei Mobile Services into your Unity game with the HMS Unity Plugin!

Easily integrate Huawei Mobile Services into your Unity game with the HMS Unity Plugin!

We may earn a commission for purchases made using our links.

Huawei Mobile Services, or HMS, is Huawei’s alternative to GMS, consisting of user-facing apps as well as core background services. The idea behind Huawei Mobile Services is to provide an experience that is consistent across devices and independent of the platform update. HMS Ecosystem has seen its monthly average users increase from 420 Million globally in July 2018 to a huge 600 Million by December 2019, while developers registered on this platform grew from 450,000 to 1.3 million in the same time period, and HMS Core app integration grew from 20,000 apps to 55,000 apps. According to additional figures revealed by Huawei as of December 2019, HMS Core has a global reach of 600 Million users in more than 170 countries (including China).

These numbers are helpful to both app and game developers, both of which can provide their services to end-users through the Huawei AppGallery on Huawei and Honor devices. Because of the number of Huawei and Honor smartphone users across the globe, there is a lot of incentive for app and game developers alike to jump onto the HMS platform and AppGallery. Further, the platform provides them with features such as cost-effectiveness, a unified portal for one-stop integration, and precise user targeting through multiple promotion channels.

If you are a developer looking to support Huawei and Honor devices, Huawei provides a lot of ready documentation for easy integration of its APIs within the developer’s resources. There are tools available for game developers too, allowing them to incorporate all the necessary features that are needed to build a mobile game that not only functions as a good mobile game but also has the necessary upscaling potential to grow itself into a successful title.

If you are looking for ways to build up your game with HMS support, your job is now made much easier thanks to this HMS Unity Plugin. The plugin helps you integrate all the power of Huawei Mobile Services in your Unity game, allowing you to leverage the power of Huawei’s powerful APIs like Huawei Account Kit, Push Kit, Game Service, Ads Kit, and In-App Purchases.


Brief Overview of some of Huawei Mobile Services API

Huawei Account Kit

Huawei Account Kit allows developers to use an existing Huawei account as a valid sign-in option within their game, letting players have less introduction fatigue and skip steps like email address and mobile number verification. It further helps with the user onboarding process and lowers the user churn during registration and login, thanks to features such as secured login, one-click authorization, support for two-factor authentication, data encryption, and GDPR compliance for privacy.

Push Kit

Push Kit allows developers to send messages from the cloud to your users, serving as a reliable, real-time push message platform with global coverage, spreading over 200+ countries. Game developers can take advantage of the precise targeting features it offers to promote the entertainment quotient of their game. Through intelligent message pushing, developers can also promote interactions and transactions within the game.

Game Service

Game Service provides an easy way for signing-in and tracking achievements in games. Game developers can customize up to 200 achievements for players, so there’s always some target to achieve within the game. You can also get diversified player data statistics that will let you tailor your game experience to match the needs and expectations of your playing audience. The API can also let you configure event reporting and let you customize key game events for reports, letting you analyze reported events from multiple dimensions. Of course, no game API is complete without leaderboards and saved game features, and this API includes those too. You can create multiple leaderboards to rank players in different ways, which combined with achievement tracking, provides a steady incentive for players to keep playing your game. You can also let players save their game progress on Huawei Drive, letting the saved game data be retrieved for returning players on other compatible devices as well.

Ads Kit

Ads Kit within HMS is an important monetization medium, and game developers can take advantage of it to maintain a Free-to-Play game through ad-support. The API provides unique device-level ad identifiers and ad-conversion tracking capabilities. Ads Kit makes use of OAID (Open Advertising ID) solution as a non-permanent ad identifier, allowing developers to balance user privacy and still provide personalized ads and accurately track advertisement effects.

In-App Purchase

As for In-App Purchases, as its name implies, it is the API responsible for integrating a seamless in-app purchase experience within an app or game. It supports subscription services, product management with automatic pricing for products in local currencies, order management, and related promotional activities. The intention behind In-App Purchases is to simplify the payment access process and simplify the access and interaction logic so that developers can focus more on developing and perfecting their game products without worrying too much about the revenue collection process.


HMS Unity Plugin

The HMS Unity Plugin makes it very easy to integrate HMS features into your Unity game, for in-app purchases, for Huawei Login, for push messaging, for game leaderboards, and for ad-based monetization. These features further enable you to incorporate important elements of game design such as unique player identification, in-app purchases for consumables and cosmetics, support for ads, support for push notifications, support for saved games, and game leaderboards and achievements.

IAP Demo

The plugin remains proud of these four features:

  • It has clear documentation, guiding developers with an easy-to-follow guide that contains step-by-step instructions.
  • The plugin comes with ready-to-use Prefabs.
  • The plugin also contains demo scenes to help the developer get acquainted with a live example.
  • The plugin also promises to stay updated regularly with new features, so you can rest assured that your project will not be relying on obsolete tools after some time.

Video ad demo

Integrating the plugin is very easy. All of it takes five broad yet easy steps:

  1. Register your game at Huawei Developer website
  2. Import the Plugin to your Unity project
  3. Configure your manifest
  4. Connect your game with the HMS Manager
  5. Connect the HMS Callback Handler with your game

The first requirement for integrating HMS into your game would be registering with HMS itself. The process is easy and straightforward, starting off from signing into the Developer Console, creating a new app within the AppGallery module, and then applying for the IAP service and configuring it for your game products.

The next step is to import the Unity plugin, which you can download from GitHub. Open the Unity Editor and import the custom package. The Import utility within Unity will show all items as pre-checked, so you simply have to click on Install, and Unity will deploy the plugin into your Assets folder. Next, you need to configure the plugin to work for your game by entering your game’s unique app ID, your developer CPID and the package name of your game in the prompts provided, and the plugin will automatically include all the necessary information inside the Android Manifest.

Configuring the Manifest

Once all of this is done, you need to deploy the HMS Manager prefab inside your scene. In Unity editor, locate the plugins prefab folder and drag and drop the HMS Manager to your scene, and then follow along the configuration prompts.

Huawei Mobile Services HMS Unity Plugin

Ready-to-use Prefabs

Next, call the HMS Manager through the onClick section. The final step is to connect the HMS Callback Handler with your game. The documentation guides you through the process, so you should have no difficulty.

Huawei Mobile Services HMS Unity Plugin

Demo Scenes

As one can see, getting on board HMS is surprisingly easy for a game developer, with access to easy documentation and support in case they face any difficulty. With the large userbase as an incentive, HMS does provide the incentive for budding games to consider it as their platform of choice.

If you would like to integrate Huawei Mobile Services into your game, follow along the link to the GitHub project below:

HMS Unity Plugin


We thank Huawei for sponsoring XDA. Huawei had minimal involvement in the creation of or the content within this article. In particular, they were consulted for fact-checking. Any opinions expressed are those of the author. Our sponsors help us pay for the many costs associated with running XDA, including servers, developers, writers, and more. While you may see sponsored content alongside Portal content, all of it will be clearly labeled as such. The XDA Portal team will not compromise journalistic integrity by accepting money to write favorably about a company. Our opinion cannot be bought. Sponsored content, advertising, and the XDA Depot are managed by our marketing director and not the editorial team.