How to Integrate AppMessaging in Unity Game Development

Shiddalingeshwar M S
3 min readFeb 19, 2021

--

Huawei’s App Messaging service boosts business by encouraging app users to subscribe and send in-app messages like promotional offers to attract users to engage or experience the key functionalities like providing tips, level up game, recommend the activity of a restaurant and send promotional messages to target users and subscribe to certain products.

AG Connect supports three types of messaging, as follows:

1. Pop-up message

2. Image message

3. Banner message

Development Overview

You need to install Unity software and I assume that you have prior knowledge about the unity and C#.

Hardware Requirements

  • A computer (desktop or laptop) running Windows 10.
  • A Huawei phone (with the USB cable), which is used for debugging.

Software Requirements

  • Java JDK 1.7 or later.
  • Unity software installed.
  • Visual Studio/Code installed.
  • HMS Core (APK) 4.X or later.

Integration Preparations

1. Create a project in AppGallery Connect.

2. Create Unity project.

3. Huawei HMS AGC Services to project.

4. Generate a signing certificate.

5. Generate a SHA-256 certificate fingerprint.

To generating SHA-256 certificate fingerprint use below command.

6. Configure the signing certificate fingerprint.

7. Download and save the configuration file.

Add the agconnect-services.json file following directory Assests > Plugins > Android

8. Add the following plugin and dependencies in LaucherTemplate

9. Add the following dependencies in MainTemplate.

10. Add dependencies in build script repositories and all project repositories & class path in BaseProjectTemplate.

11. Enable debug mode use in cmd prompt [optional].

12. Configuring project in AGC

13. Create Empty Game object rename to GameManager.

14. Click to Build apk, choose File > Build settings > Build, to Build and Run, choose File > Build settings > Build And Run

Result

Tips and Tricks

  • Add agconnect-services.json file without fail.
  • Add SHA-256 fingerprint without fail.
  • Make sure dependencies added in build files.
  • Make sure the image URL is correct and aspect ratio is 3:2 i.e. 300x200 is maintained in ag-connect.

Conclusion

We have learnt integration of Huawei AppMessaging Service into Unity Game development.

Thank you so much for reading article, hope this article helps you.

References

Unity Integration Manual

Android Guide

App Messaging service

Creating In-App Message

Resize image

--

--