[Huawei Developers] shikkerimath:
Introduction

Huawei provides various services for developers to make ease of development and provides best user experience to end users. In this article, we will be integrating following kits:

Ads Kit

Game services

Analytics Kit

Location Kit

Push Kit

We will learn to integrate above HMS Kits in Unity game development using official plugin. And by integrating in single application gives experience the ease of development and give best user experience and showcases stability of the kits, and how we can use kits efficiently to make users experience the best of it.

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 installation package.

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.

View attachment 5207181

3. Adding Huawei HMS AGC Services to project.

View attachment 5207189

View attachment 5207191

View attachment 5207193

View attachment 5207195

5. Generate a SHA-256 certificate fingerprint.

To generating SHA-256 certificate fingerprint use below command.

View attachment 5207199

6. Configure the signing certificate fingerprint.

View attachment 5207201

7. Download and save the configuration file.

View attachment 5207203

Add the agconnect-services.json file following dir Assets > Plugins > Android

View attachment 5207205

8. Add the following plugin and dependencies in LaucherTemplate

apply plugin: 'com.huawei.agconnect'

implementation 'com.huawei.agconnect:agconnect-core:1.4.1.300'
implementation 'com.huawei.hms:base:5.0.0.301'
implementation 'com.huawei.hms:hwid:5.0.3.301'
implementation 'com.huawei.hms:game:5.0.1.302'
implementation 'com.huawei.hms:push:4.0.1.300'
implementation 'com.huawei.hms:hianalytics:5.0.3.300'

9. Add the following dependencies in MainTemplate.

implementation 'com.huawei.agconnect:agconnect-core:1.4.1.300'
implementation 'com.huawei.hms:base:5.0.0.301'
implementation 'com.huawei.hms:hwid:5.0.3.301'
implementation 'com.huawei.hms:game:5.0.1.302'
implementation 'com.huawei.hms:hianalytics:5.0.3.300'
implementation 'com.huawei.hms:ads-lite:13.4.29.303'
implementation 'com.huawei.hms:ads-consent:3.4.30.301'
implementation 'com.huawei.hms:push:4.0.1.300'
implementation 'com.huawei.hms:location:5.0.0.301'

10. Add the following dependencies in MainTemplate.

repositories & class path in BaseProjectTemplate.

maven { url 'https://developer.huawei.com/repo/' }

classpath 'com.huawei.agconnect:agcp:1.2.1.301'

11. Add Achievement details in AGC > My apps

View attachment 5207211

12. Add LeaderBoard details.

View attachment 5207213

Continue reading..

Tips and Tricks

Add agconnect-services.json file without fail.

Add SHA-256 fingerprint without fail.

Add Achievements and LeaderBoad details before run.

Make sure dependencies added in build files.

Enable location and accept permission to read location.

Conclusion

We have learnt integration of HMS GameService Kit, Ads Kit,Location kit, Push Kit and Analytics kit in Unity. Error code while fetching Player extra information and Event Begin and end.

7006: The account has not been registered in Chinese mainland. In this case, perform bypass and no further action is required.

Thanks for reading, please do like and comment your queries or suggestions.

Read full article

References

Hms game services

HMS Ads Kit

HMS Analytics Kit

HMS Push Kit

Location Kit