How to Integrate Huawei HMS Core

Huawei Mobile Service (HMS) encompasses Huawei’s chip, device and cloud capabilities, including a full portfolio of HMS core services and associated IDE tool platforms for development and testing, as well as key applications for Huawei devices. Huawei Mobile Services (HMS) Apps section includes Huawei AppGallery, Huawei Assistant, Huawei Browser, Huawei Cloud, Huawei Wallet, Huawei Video, Huawei Music, etc.

How to integrate Huawei HMS Core?

Here’s how to do Preparations for Integrating HUAWEI HMS Core, follow the below steps.

  1.  Creating an App in AppGallery Connect.
  2.  Add Package Name.
  3. Creating an Android Studio Project.
  4.  Generating a Signing Certificate.
  5. Generating a Signing Certificate Fingerprint.
  6. Add a fingerprint certificate to AppGallery Connect.
  7. Add Maven libraries and plugin.
  8. Configure project signature.
  9. Sync Project.

1. Creating an App in AppGallery Connect.

During this step, you will create an app in AppGallery Connect (AGC) of HUAWEI Developer. When creating the app, you will need to enter the app name, app category, default language, and signing certificate fingerprint. After the app has been created, you will be able to obtain the basic configurations for the app, for example, the app ID and app secret, which will then be used in subsequent development activities.

Sign in to HUAWEI Developer and click Console.

Sign in to HUAWEI Developer
Sign in to HUAWEI Developer

Click the HUAWEI AppGallery card and access AppGallery Connect.

AppGallery Connect
AppGallery Connect

On the AppGallery Connect page, click My apps.

My apps page
On the displayed My apps page, click New.

My apps page click new
Enter the App name, select App category (options: App and Game), and select Default language as needed,

Enter the App name

Upon successful app creation, the App information page will automatically display. There you can find the App ID and App Secret that are assigned by the system to your app.

App ID

 

2. Add Package Name

The developer sets the package name of the created application on the AGC.

  • Manually enter the package name.
  • Open the previously created application in AGC application management and select the Develop TAB to pop up an entry to manually enter the package name and select manually enter the package name.
  • Fill in the application package name in the input box and click save.
  • Upload install APK file to add package name.
  • Open the previously created application in AGC application management and select the Develop TAB. You can choose to upload the package to get the package name.Or just click Distribute -> Release app -> Version Infomation -> Draft-> Software version.
  • Select Manage package, and then in the pop-up box, select upload.
  • In the pop-up upload prompt box, select has been generated APK file.
  • Select save after successful upload.

3. Creating an Android Studio Project

During this step, you will create a new Android Studio project for your app, When creating the project, you will need to use the app name that you have specified in AppGallery Connect.

  • Start Android Studio. On the menu bar, go to File->New->New Project.
  • On the Choose your project page, click Empty Activity, and then click Next.
  • On the Configure your project page, enter Name (it’s the same as the input on AppGallery Connect) and Package name (it’s the same as the input on AppGallery Connect) for your app, select Save location, Minimum API level, and then click Finish. You have now created a project for your app.

4. Generating a Signing Certificate

During this step, you will create a new signature file in Android Studio, which will be used for generating the SHA-256 fingerprint for your app.

  • In the menu bar of the Android Studio project that you have created, go to Build>Generate Signed Bundle/APK.
  • On the Generate Signed Bundle or APK page, select APK and click Next.
  • If you’ve already had a signature file, click Choose existing… , select the signature file, and specify Key store password,Key alias, and Key password for it. After completing this, click Next.
  • If you don’t have a signature file, click Create new.
  • Specify relevant information including Key store path, Password, and Key Alias.
  • After successfully creating the signature file, you will find the signature file information on the automatically displayed Generate Signed Bundle or APK page. Click Next.
  • On the displayed page, select V1 and V2 next to Signature Versions, and then click Finish. You have now created a signed APK (This APK file can be used to upload the generated package name).

5. Generating a Signing Certificate Fingerprint

During this step, you will need to export the SHA-256 fingerprint by using a key tool provided by the JDK and signature file.

  • Open the command window and access the bin directory where the JDK is installed.
  • Run the following keytool command in the bin directory and enter the password for the signature file key. This password was specified when the signature file was created.
  • Obtain the SHA-256 fingerprint from the result.

6. Add fingerprint certificate to AppGallery Connect

During this step, you will configure the generated SHA-256 fingerprint in AppGallery Connect.

  • In AppGallery Connect, click the app that you have created and go to Develop -> Overview.
  • Go to the App information section and enter the SHA-256 fingerprint that has been generated.
  • Click √ to save the fingerprint.
  • Upon completion, the signing certificate fingerprint will take effect immediately.

7. Add Maven libraries and plugin

  • In Android Studio root-level (project-level) build.gradle file, add rules to include the HUAWEI agcp plugin and HUAWEI Maven repository.
  • In your module (app-level) build.gradle file (usually app/build.gradle), add a line to the bottom of the file.

8. Configure project signature

  • Copy the generated signature file hmsdemo.jks into the app folder and open your module (app-level) build.gradle file (usually app/build.gradle).
  • Add the signature configuration in the android directory of build.gradle file.

9. Sync Project

  • Click sync now to synchronize the project
  • Completed successfully that means successful synchronization, and the integration preparation is completed.

RelatedHow to create a Huawei ID quickly

Source: Huawei

Related Posts

Leave a Comment