{"id":26188204,"url":"https://github.com/waitaction/cordova-plugin-cnpush","last_synced_at":"2025-04-15T01:01:21.991Z","repository":{"id":57207981,"uuid":"191275478","full_name":"waitaction/cordova-plugin-cnpush","owner":"waitaction","description":null,"archived":false,"fork":false,"pushed_at":"2020-11-12T08:43:07.000Z","size":1242,"stargazers_count":6,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-28T12:51:17.577Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/waitaction.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-11T02:02:43.000Z","updated_at":"2023-06-14T06:18:09.000Z","dependencies_parsed_at":"2022-09-10T07:20:18.356Z","dependency_job_id":null,"html_url":"https://github.com/waitaction/cordova-plugin-cnpush","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitaction%2Fcordova-plugin-cnpush","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitaction%2Fcordova-plugin-cnpush/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitaction%2Fcordova-plugin-cnpush/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waitaction%2Fcordova-plugin-cnpush/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waitaction","download_url":"https://codeload.github.com/waitaction/cordova-plugin-cnpush/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248986309,"owners_count":21194025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-11T23:57:32.478Z","updated_at":"2025-04-15T01:01:21.963Z","avatar_url":"https://github.com/waitaction.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 统一推送\n\n安装 `cordova-plugin-cnpush`\n \n``` shell\n cordova plugin add cordova-plugin-cnpush\n```\n\n\u003e cordova应用统一推送，可以安装下列插件，`cordova-plugin-cnpush`会根据手机型号优先使用`厂商sdk`的cordova插件\n\n## 安卓手机推送(非厂商sdk)\n\n其它安卓手机使用推送，安装 `极光推送安卓版本(免费版)` 插件\n\n``` shell\ncordova plugin add cordova-plugin-android-jpush --variable APP_KEY=your_jpush_appkey\n```\n\n## 华为推送(厂商sdk)\n\n如需在`华为手机`使用系统级推送，请安装 `华为推送` 插件\n\n``` shell\ncordova plugin add cordova-plugin-huawei-push\n```\n\n## OPPO推送(厂商sdk)\n\n如需在`OPPO手机`使用系统级推送，请安装 `OPPO推送` 插件\n\n``` shell\ncordova plugin add cordova-plugin-oppo-push --variable  APP_KEY=YOUR_APP_KEY --variable APP_SECRET=YOUR_APP_SECRET\n```\n\n\n\u003e 各依赖插件的配置，请参考插件官方文档\n\n## 使用\n\n使用前需注册，以获取 `token` ，你可以将 `token` 与你的app用户信息关联后上传到服务器\n\n``` js\n// 注册推送\ncnPush.register(function(token) {\n    console.log(token);\n}, function(err) {\n    console.log(err);\n}, []);\n\n// 接收token\ncnPush.onNewToken(function(token) {\n    console.log(token); // 会多次接收到token\n});\n```\n\n注册完成后，需要监听 `messageReceived` 事件\n\n``` js\ndocument.addEventListener(\"messageReceived\", function(result) {\n    console.log(result);\n}, false);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaitaction%2Fcordova-plugin-cnpush","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaitaction%2Fcordova-plugin-cnpush","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaitaction%2Fcordova-plugin-cnpush/lists"}