cordova-plugin-hms-analytics

0.1.0 • Public • Published

hms-analytics

Installing

  1. The first step would be to clone this repo in your ionic project root directory. To do that you need to run following command in terminal or in git bash.
git clone https://github.com/cloonegit/hms-analytics.git
  1. Add the plugin
ionic cordova plugins add hms-analytics
  1. In your ionic project build.gradle (inside platform/android), add
buildscript {
    repositories {
        google()
        jcenter()
        maven { url 'http://developer.huawei.com/repo/' }
    }

    dependencies {
        classpath 'com.huawei.agconnect:agcp:1.0.0.300'
    }
}
...
  1. Add agconnect-services.json file inside platform/android/app

Use

  1. To apply the plugin, add following code
declare var cordova: any;

let packageId = 'xxx.xxxxxx.xxxxx';
let pageName = 'Home';
let eventName = 'Home';
let eventData = {
  'key': 'value'
};

cordova.plugins.HmsAnalytics.logEvent(
  packageId, pageName, eventName, eventData,
  (data) => { console.log(data) },
  (err) => { console.log(err) }
);

Package Sidebar

Install

npm i cordova-plugin-hms-analytics

Weekly Downloads

1

Version

0.1.0

License

ISC

Unpacked Size

6.78 kB

Total Files

6

Last publish

Collaborators

  • syazanihussin