@hmscore/hms-js-push
v1.0.300
Published
hms push js
Downloads
2
Readme
hms-js-push
Contents
- Introduction
- Installation Guide
- Function Definitions
- Configuration & Description
- 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.