Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-plugin-cnpush

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-cnpush

Cordova Push Plugin

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-90.91%
Maintainers
1
Weekly downloads
 
Created
Source

统一推送

安装 cordova-plugin-cnpush

 cordova plugin add cordova-plugin-cnpush

cordova应用统一推送,可以安装下列插件,cordova-plugin-cnpush会根据手机型号优先使用厂商sdk的cordova插件

安卓手机推送(非厂商sdk)

其它安卓手机使用推送,安装 极光推送安卓版本(免费版) 插件

cordova plugin add cordova-plugin-android-jpush --variable APP_KEY=your_jpush_appkey

华为推送(厂商sdk)

如需在华为手机使用系统级推送,请安装 华为推送 插件

cordova plugin add cordova-plugin-huawei-push

OPPO推送(厂商sdk)

如需在OPPO手机使用系统级推送,请安装 OPPO推送 插件

cordova plugin add cordova-plugin-oppo-push --variable  APP_KEY=YOUR_APP_KEY --variable APP_SECRET=YOUR_APP_SECRET

各依赖插件的配置,请参考插件官方文档

使用

使用前需注册,以获取 token ,你可以将 token 与你的app用户信息关联后上传到服务器

// 注册推送
cnPush.register(function(token) {
    console.log(token);
}, function(err) {
    console.log(err);
}, []);

// 接收token
cnPush.onNewToken(function(token) {
    console.log(token); // 会多次接收到token
});

注册完成后,需要监听 messageReceived 事件

document.addEventListener("messageReceived", function(result) {
    console.log(result);
}, false);

Keywords

FAQs

Package last updated on 11 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc