Skip to content

HmsAnalyticsKitDemo is a app that applying HUAWEI Hianalytics SDK used for showing how to collect user engagement and user preference.

License

Notifications You must be signed in to change notification settings

HMS-Core/hms-analytics-demo-harmonyos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HUAWEI AnalyticsKit Demo for HarmonyOS

English | 中文

Table of Contents

Introduction

AnalyticsKitDemo provides an example of integrating HUAWEI Analytics Kit with an Hap. It illustrates how to collect predefined events and custom events to improve user engagement and user preference. Read more about Analytics Kit.

Getting Started

For more development guidance, please refer to the links below:

Development Guide.

API References.

In this example, we demonstrate how to use the analytics SDK for HarmonyOS by using the Gradle build system.

First download AnalyticsKitDemo by cloning this repository or downloading an archived snapshot.

In HUAWEI DevEco Studio, click Open Project, and select AnalyticsKitDemo.

You can use the gradlew build command to build the project directly.

You should create an Hap in AppGallery Connect, and obtain the agconnect-services.json file and add it to the project. You should also generate a signing certificate fingerprint and add the certificate file to the project, and add configuration to the build.gradle file. More to Development Process.

Installation

Use HUAWEI DevEco Studio to open the decompressed project.

Configuration

  1. Create an Hap in AppGallery Connect and obtain the project configuration file agconnect-services.json. In HUAWEI DevEco Studio, switch to the Project view and move the agconnect-services.json file to the root directory of the entry.
  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.

Environment requirements

Hardware requirements:

  1. A computer (desktop or laptop)
  2. A Huawei phone, which is used to debug the developed Hap

Software requirements:

  1. HUAWEI Analytics Kit 6.3.2
  2. HarmonyOS SDK applicable to devices using HarmonyOS 2.0.0 (API level 4) and later versions
  3. HUAWEI DevEco Studio
  4. JDK version: 1.8 or later

Result

After running the Hap you should see a screen like this:

Click True or False to answer the question; Click Next to show the next question; Click Post Score, log the score user got. All the information will be uploaded to the Analytics Kit Console, and you can see these information in real time using Debug View.

Click button Settings:

When you click Settings, you will be asked for your favorite sport. Your choice will be logged by Analytics Kit as a user attribute.

License

AnalyticsKitDemo is licensed under the Apache License, version 2.0.

About

HmsAnalyticsKitDemo is a app that applying HUAWEI Hianalytics SDK used for showing how to collect user engagement and user preference.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages