Integration of Huawei AppLinking in Unity Game Development
AppLinking provides a way to create cross-platform links that can work as defined regardless of whether your app has been preinstalled or not. A link created in App Linking can be distributed through multiple channels to users. When a user taps the link, the user will be redirected to specified in-app content or webpage.
Introduction
AppLinking provides a way to create cross-platform links that can work as defined regardless of whether your app has been preinstalled or not. A link created in App Linking can be distributed through multiple channels to users. When a user taps the link, the user will be redirected to specified in-app content or webpage.
In App Linking, you can create both long and short links. It automatically identifies the source of a user and you can set tracing parameters when creating a link of AppLinking which helps you to trace traffic sources. By analyzing the link performance of each traffic source based on the tracing parameters, you can find the platform that can achieve the best promotion effect for your app and also you can see the data statics of AppLinking in ag-console.
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. Enable AGC Log mode in Android studio Terminal[optional].
14. Create Empty Game object rename to GameManager, UI canvas texts and button and assign onclick events to respective text and button as shown below.
15. Click to Build apk, Choose File > Build settings > Build, to Build and Run, Choose File > Build settings > Build And Run
16. Result
Tips and Tricks
- Add agconnect-services.json file without fail.
- Add SHA-256 fingerprint without fail.
- Make sure debug enabled[optional] to read real time data in app debugging page.
- Make sure dependencies added in build files.
Conclusion
We have learnt integration of Huawei AppLinking Service into Unity Game development. In App Linking, you can create both long and short links which identify in-app link for app and web pages in web automatically.
Thank you so much for reading article, I hope this article helps you.
References