Coder Social home page Coder Social logo

alice135670 / hms-analytics-demo-harmonyos-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hms-core/hms-analytics-demo-harmonyos-js

0.0 0.0 0.0 55 KB

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

License: Apache License 2.0

Java 16.40% JavaScript 58.80% CSS 24.80%

hms-analytics-demo-harmonyos-js's Introduction

Analytics SDK Sample Code (for HarmonyOS)

Contents

Introduction

HmsAnalyticsKitDemo provides an example of integrating Analytics Kit into an HAP. It illustrates how to collect predefined events and custom events to improve user engagement and user preference. Learn more about Analytics Kit.

Getting Started

For details, please refer to the links below:

Development Guide

API Reference

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

First, download HmsAnalyticsKitDemo by cloning this repository or downloading the compressed package.

In HUAWEI DevEco Studio, click Open... and select HmsAnalyticsKitDemo.

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

Create an app in AppGallery Connect, obtain the agconnect-services.json file, and add the file to your project. In addition, you need to generate the signing certificate fingerprint, add the certificate file to the project, and add the configuration to the build.gradle file. Click here to learn more.

Installation

  1. Use HUAWEI DevEco Studio to open the decompressed project.
  2. Run the following command in the entry directory:
    npm install

Configuration

  1. Create an app in AppGallery Connect and obtain the app configuration file agconnect-services.json. In HUAWEI DevEco Studio, switch to the Project view and move the agconnect-services.json file to the entry directory.
  2. Change bundleName in the config.json file in the entry directory to the HAP name obtained in the first step.
  3. Change bundlename in the app.js file in the js directory to the HAP name obtained in the first step.

Environment Requirements

Hardware:

  1. A computer (desktop or laptop)
  2. A Huawei phone used for app debugging

Software:

  1. Analytics Kit 6.3.0
  2. HarmonyOS 2.0.0 (API level 4) or later
  3. HUAWEI DevEco Studio
  4. JDK version: 1.8 or later

Operation Result

After running the app, you will see the following screen.

Tap TRUE or FALSE to answer the question; tap NEXT to go to the next question; tap POST SCORE to record the obtained score. All information will be uploaded to the console of Analytics Kit. You can use DebugView to view the information in real time.

Tap SETTINGS, and you will see the following screen.

On the screen displayed, you can set your favorite sport. Your configuration will be recorded in the Analytics SDK as a user attribute.

License

HmsAnalyticsKitDemo is licensed under Apache 2.0.

hms-analytics-demo-harmonyos-js's People

Contributors

return8023 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.