Skip to content

HMS-Core/hms-analytics-demo-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HMS AnalyticsKit Demo for Android

hms

English | 中文

Table of Contents

Introduction

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

You also can use HMS Toolkit to quickly integrate the kit and run the Java demo project, as well as debug the app using a remote device for free. For details, please visit HMS Toolkit.

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 Android by using the Gradle build system.

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

In Android Studio, click Open an existing Android Studio project, and select "java" or "kotlin".

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

You should create an app in AppGallery Connect, and obtain the agconnect-services.json file and add it to the project. More to Development Process.

Installation

Use Android Studio to open the decompressed project.

Configuration

  1. Create an app in AppGallery Connect and obtain the project configuration file agconnect-services.json. In Android Studio, switch to the Project view and move the agconnect-services.json file to the root directory of the app.
  2. Change the value of applicationId in the build.gradle file of the app to the name of the app package applied for in the preceding step.

Environment requirements

Hardware requirements:

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

Software requirements:

  1. HUAWEI Analytics Kit 6.7.0
  2. Android SDK applicable to devices using Android 4.3 Jelly Bean (API level 18) and later versions
  3. Android Studio
  4. JDK version: 1.8 or later

Result

After running the app 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 Hianalytics 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 Hianalytics as a user attribute.

Question or issues

If you want to evaluate more about HMS Core, HMSCore on Reddit is for you to keep up with latest news about HMS Core, and to exchange insights with other developers.

If you have questions about how to use HMS samples, try the following options:

  • Stack Overflow is the best place for any programming questions. Be sure to tag your question with huawei-mobile-services.
  • Huawei Developer Forum HMS Core Module is great for general questions, or seeking recommendations and opinions.

If you run into a bug in our samples, please submit an issue to the Repository. Even better you can submit a Pull Request with a fix.

License

HmsAnalyticsKitDemo is licensed under the Apache License, version 2.0.