1.0.300 • Published 4 years ago

@hmscore/hms-js-push v1.0.300

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

hms-js-push

Contents

  1. Introduction
  2. Installation Guide
  3. Function Definitions
  4. Configuration & Description
  5. Licencing & Terms

1. Introduction

The SDK provides the ability to use HMS Push with JavaScript under multiple platforms (RN, OHOS, Fast APP).

2. Installation Guide

  • Go to your project
cd example/
  • Install
npm i @hmscore/hms-js-base
npm i @hmscore/hms-js-push
project-name
    |_ node_modules
        |_ ...
        |_ hms-js-base
        |_ hms-js-push
        |_ ...
  • Initialize the hms-js-base

Define the global event callback collection eventCallbackMap in app.js, and then initialize the base at the onCreate method.

import {hmsjsb} from '@hmscore/hms-js-base'

export default {
    //Define the global
    hmsData: {
        eventCallbackMap: {}
    },
    //init
    onCreate() {
        console.info('AceApplication onCreate');
        hmsjsb.init(this.hmsData.eventCallbackMap);
    },
    onDestroy() {
        console.info('AceApplication onDestroy');
    }
}
  • Add hms-js-push package to your application
import hmspush from '@hmscore/hms-js-push'
  • sample

hmspush.getToken(function (result, resultInfo) {
    console.info("gettoken is " + result + ", resultInfo is " + resultInfo);
});

3. Function Definitions

  • Function Definitions
    • hmspush.turnOnPush((responseCode, responseMessage) => {})
    • hmspush.turnOffPush((responseCode, responseMessage) => {})
    • hmspush.getToken((responseCode, responseMessage) => {})
    • hmspush.deleteToken((responseCode, responseMessage) => {})

4. Configure parameters.

No.

5. Licensing and Terms

hms-js-push SDK uses the Apache 2.0 license.