Essentials: Move your app to Huawei AppGallery with these simple steps!

Muhammed Enes Simsek
Huawei Developers
Published in
8 min readMay 6, 2021
Welcome to Huawei AppGallery!

Introduction

If you are considering to publish your app on Huawei AppGallery, you need to go through some steps. They are all simple on their own, but once you have them on your to-do list in order, it may be overwhelming and, I’ll admit, confusing at times. No worries, I got you in this article. I will walk you through the simple steps required at the beginning of moving your app to AppGallery.

Please also note that this is not a kit-specific scenario narration, i.e. for the most kits, these steps are required. I will try to keep it as general as possible, so that this article serves as a guide to both Java and Android developers, although I mainly focus on Unity game development these days. If you have come to this article as a Java developer, some steps may not be relevant to you or may not be required at all. I will act as a game CP (content provider) that wants to move their apps to AppGallery. If you think I still omitted some steps to be done, please comment below so I can address them as well.

The purpose of this article is to show you the steps in detail and more importantly, in one place that are required to be done to start coding with Huawei’s kits. Please note that these steps may not be the same for all development scenarios, although, in reality, it should not highly differ.

The bullet list of what I am going to talk about is given below.

  1. Registering as a Huawei Developer
  2. Creating a project and adding the app in AppGallery Connect
  3. Generating the keystore
  4. Generating a signing certificate fingerprint
  5. Adding that fingerprint back to AGC
  6. Downloading agconnect-services.json file

6 Steps to Set Up AGC Side of Your App

1) Register as a Huawei Developer

Go to this link and click “Sign Up” in the right-top corner or use this link directly to go to sign up page. You can sign in if you already have an account.

Developer console

2) Creating a project and adding the app in AppGallery Connect

In the console, go to “App Services” tab and click “AppGallery Connect” to reach AGC.

AppGallery Connect

In the AGC, click “My Projects” so we can create a project for your app. Later, we will also create an app and add to this project.

My projects

In “My projects”, click “Add Project” and in the page displayed, enter a project name. I will name mine MediumArticleProject.

Project page will display. There, click “Add app”. There has to be an app that is associated with your project.

Add app

In the displayed page, you need to enter app details. I fill mine as below.

App settings

A very important remark is that, do not forget to use “.huawei” or “.HUAWEI” suffix in your app package name for AppGallery if you want to use IAP (in-app purchases) in your app. You need to change your package name, if this is not the case for your app currently.

After you are done, AGC will recommend you a 3-step integration guide as shown below. You can follow them if you are adding an app to be developed in Android Studio. For games developed in Unity, the process is a bit different. I talk about integration part of it here.

Setting up SDK

This json file is very important and these steps should be done. If you are using Android Studio, I recommend that you should do them. After you are done, click “Finish”.

Now, our app is added to our project.

In the “General Information” tab you can observe “Developer ID” and “App ID” when you slide down. There are other public and private important information about your app too.

3) Generating the keystore

We need to generate a .jks file now. I will use Android Studio to show you how to generate one. If you are using Unity, the process is very similar. Where you should look at is “Build Settings -> Player Settings -> Publishing Settings”.

In Android Studio, go to Build -> Generate Signed Bundle/APK -> Choose APK. A pop-up will appear where you should enter the details of the keystore.

Click “Create New” below to generate a keystore file.

Key store password

Unlike the misleading outlook, you should enter the path yourself and not choose any existing. A sample is shown below. All the passwords must be remembered, so be careful. For the sake of simplicity, I gave the same simple password to all of them.

Key alias

You can modify the information above as per your needs. For the path, as I said, you should enter the path that you want it to be created. (you do not have search your computer to find any .jks files). Plain /Desktop may give an error, so I suggest you add something like “C:\Users\…\Desktop\myKeystore.jks” so the new keystore will carry that name. Click “OK” when you are done and click next after entering the password in the returned pop-up above. Screen below will appear.

Make sure that you choose release in the variant and also to tick both V1 and V2 boxes. Then, you can click “Finish”.

Android Studio should build and finish the generation of .jks file. If there is an error in building, do not worry. You need to carry your .jks file in the app level directory in your Android project anyway. Do it now and try again, you should be able to build now.

Now we need to get the SHA-256 key and paste it back to AGC.

4) Generating a signing certificate fingerprint

For this, you need to open Command Prompt in Windows or use any terminal where the JRE is installed. It may take some time for you to find it, so let me help you. By default, although it may differ in some computers, it should be placed here:

C:\Program Files\Android\Android Studio\jre\bin

In CMD, type this:

cd C:\Program Files\Android\Android Studio\jre\bin

You are directed to JRE directory. You should execute the following command to get the SHA-256 key:

keytool -list -v -keystore "replace-with-your-keystore-directory"

And for my case, since I transfered my keystore to the app level directory in my Android app, it is:

C:\Users\...\Desktop\MediumTestApp\app\myKeystore.jks

Make sure to delete the quotation marks after you paste your .jks file path. So, in the end, it should be something like this:

keytool -list -v -keystore C:\Users\...\Desktop\MediumTestApp\app\myKeystore.jks

As can be seen above, you can go to your app details and click on the bar to get the full directory, and then you can add the jks file name manually and paste it to Command Prompt.

After you execute the “keytool …” command above, if everything is right, cmd should ask you the password. This is the password that you set earlier. Enter the password and a lot of information will be displayed. SHA-256 should display as below.

SHA-256 signature

Copy this SHA-256 key and proceed to next step.

5) Adding that fingerprint back to AGC

Now that you have SHA-256 key on your clipboard, proceed to General Settings tab and slide down. There you will find “App Information” part where you should enter this key. See the plus sign below.

Then paste your SHA-256 there. Click √ and you are done.

6) Downloading agconnect-services.json file

You can now download agconnect-services.json file again and replace the older one to make sure that everything is right. Keep in mind that this json file goes to app-level gradle directory (same directory that .jks file was put) in Android Studio and goes to StreamingAssets folder in Unity with HMS Plugin 2.0. This is a very important file that links your app with AGC and enables you to use kits.

You can go to “Manage APIs” tab and enable the kits that you want to use in your app. You are done with the general AppGallery Connect configurations and you can proceed to coding part. Of course, in some of the kits like GameService or Push Kit, you will have to further configure the in-AGC settings, however, since they are kit-specific, they are out of the scope of this article.

Tips & Tricks

  • I am saying it once more: Do not forget to change/assign your package name with .huawei or .HUAWEI suffix to be able to use joint operations like IAP. Keep in mind that that suffix is case-sensitive, thus make sure that you use all lowercase or all uppercase.
  • If you have multiple projects that you need to configure, you can open them side by side with this article to make the steps easier and less repetitive for yourself
  • For HMS Unity Plugin 2.0 and Unity integration you may refer to this article series. AGC part of those series will be the same, however, they contain kit-specific Unity configurations as well.

Conclusion

We finished our AGC side configurations for the app that we want to release in AppGallery. This was not all-encompassing article that talks about all HMS kits but rather a general article that aims to facilitate the process of AGC configuration for the developers that comes from all backgrounds.

I hope that this article has been helpful for you.

See you in my other articles!

--

--