npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cordova-ohos/cordova-plugin-huawei-push

v1.0.2

Published

Cordova alipay Plugin

Downloads

133

Readme

cordova-plugin-huawei-push

cordova-plugin-huawei-push 这是一个用于在 Cordova/Ionic 混合移动应用中集成 Huawei Push Kit(华为推送服务)的官方插件。它允许应用接收来自华为服务器的通知消息,从而在华为设备(尤其是没有 Google Mobile Services 的设备)上实现推送功能,此插件的使用需要后台服务端的配合。

前置条件

1,访问 华为开发者联盟

2,创建新应用或选择现有应用

3,启用 Push Kit 服务

4,根据华为的文档配置开通push服务,

安装方式

基础安装

# 安装hcordova
npm install -g hcordova

# 安装最新版本
hcordova plugin add cordova-plugin-huawei-push

# 安装指定版本
hcordova plugin add [email protected] --platform ohos

从 GitCode 源码安装

hcordova plugin add https://gitcode.com/OpenHarmony-Cordova/cordova-plugin-huawei-push.git --platform ohos

卸载插件

如需移除插件,执行以下命令即可清理相关配置与依赖:

# 全平台卸载
hcordova plugin remove cordova-plugin-huawei-push

# 指定OHOS卸载
hcordova plugin remove cordova-plugin-huawei-push --platform ohos

HarmonyOS配置

修改项目中的EntryAbility的代码,添加推送插件在ArkTS侧监听和初始化:

export default class EntryAbility extends UIAbility {
   onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
      pagePushNotify(want.parameters);//点击通知消息传送数据给cordova
   }

   onNewWant(want: Want): void {
      pagePushNotify(want.parameters);//点击通知消息传送数据给cordova
   }
}

API 说明

注册HarmonyOS推送服务

注册成功后,返回token,将token发送到服务器后端,发送推送消息时需要。

huaweiPush.register(function(token) {
    console.log("huaweitoken:"+token);
}, function(err) {
    console.log(err);
}, []);

监听收到推送通知

应用在前台时,收到通知通知到js侧,如果应用不在活跃状态,应用激活后,会收到通知

document.addEventListener("huaweiMessageReceived", function(content){
    console.log(content);
},false);

返回content的,不同的通知,内容不同点击查看华为推送说明

许可证

本插件基于 Apache License 开源,详见 LICENSE 文件。

联系方式

OHOS Cordova https://gitcode.com/OpenHarmony-Cordova/cordova-plugin-huawei-push

Android/iOS:https://npmjs.com/cordova-plugin-huawei-push/issues