We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
Notice on Closing the Huawei Analytics Service Access Portal

Dear developer!

Due to business adjustments, we will close the entrance for Huawei Analytics services on June 30, 2024 and no longer support new user registration. Developers of projects that have already activated Huawei Analytics services are not affected and can still continue to use Huawei Analytics services. If there are any changes, we will notify them separately. Thank you for your support!

SamplesAnalytics KitHarmonyOS Sample Code (JavaScript)

HarmonyOS Sample Code (JavaScript)

The sample code provides a demo project that demonstrates how to call open APIs of Analytics Kit. Guided by the demo, you will learn how to:

  • Use HUAWEI DevEco Studio to efficiently integrate Analytics Kit.
  • Correctly use APIs of Analytics Kit.
Expand

Sample Code

Find It on Gitee

Find It on GitHub

HUAWEI DevEco Studio sample code

Click here

Click here

NOTE

Before using the sample code, read the README file in the sample project carefully. You can use the sample code only after completing the following operations:

  1. Sign in to AppGallery Connect, download the agconnect-services.json file of your app, and copy the file to the entry directory of the demo project.

  2. Open the config.json file in the entry directory of the sample project, and change the value of bundleName to your app package name. In the abilities element, declare the AppGallery Connect provider and replace com.example.myapplication with your app package name.

  3. Change bundleName in the app.js file in the entry > src > main > js > default directory of the sample project to your app package name.
Search in Samples
Enter a keyword.