Skip to content

The huawei push for cordova, hms sdk version, now only support android.

License

Notifications You must be signed in to change notification settings

iflamed/cordova-huawei-push

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-huawei-push

The huawei push for cordova, hms sdk version, now only support android.

Install

cordova plugin add cordova-huawei-push --variable APPID=YOURAPPID --variable  PACKAGENAME=YOURPACKAGENAME --save

How to use

Init the hms connection

cordova.plugins.huaweipush.init();

Token Registered

document.addEventListener('huaweipush.receiveRegisterResult', function (event) {
    console.log(event) // event will contain the device token value
}.bind(this), false);

You can get the token value by event.token

Stop the push service

cordova.plugins.huaweipush.stop();

When notification clicked to open the app

document.addEventListener('huaweipush.notificationOpened', function (event) {
    console.log(event) // the event will contain a extras key, which contain the data what you send
}.bind(this), false)

When push message arrived at the app open status

document.addEventListener('huaweipush.pushMsgReceived', function (event) {
    console.log(event) // the event will contain a extras key, which contain the data what you send
}.bind(this), false)

About

The huawei push for cordova, hms sdk version, now only support android.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages