{"id":17925148,"url":"https://github.com/hsuanxyz/ionic2-jpush","last_synced_at":"2026-04-01T22:04:35.418Z","repository":{"id":57276085,"uuid":"79710824","full_name":"hsuanxyz/ionic2-jpush","owner":"hsuanxyz","description":"ionic2激光推送的封装基于 jpush-phonegap-plugin","archived":false,"fork":false,"pushed_at":"2017-11-14T02:02:22.000Z","size":1930,"stargazers_count":57,"open_issues_count":0,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-03-28T00:37:44.109Z","etag":null,"topics":["ionic2","jpush","ts"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hsuanxyz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-22T10:29:39.000Z","updated_at":"2026-03-14T13:23:10.000Z","dependencies_parsed_at":"2022-08-25T01:14:18.540Z","dependency_job_id":null,"html_url":"https://github.com/hsuanxyz/ionic2-jpush","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hsuanxyz/ionic2-jpush","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsuanxyz%2Fionic2-jpush","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsuanxyz%2Fionic2-jpush/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsuanxyz%2Fionic2-jpush/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsuanxyz%2Fionic2-jpush/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hsuanxyz","download_url":"https://codeload.github.com/hsuanxyz/ionic2-jpush/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hsuanxyz%2Fionic2-jpush/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31292631,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["ionic2","jpush","ts"],"created_at":"2024-10-28T20:52:51.528Z","updated_at":"2026-04-01T22:04:35.387Z","avatar_url":"https://github.com/hsuanxyz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ionic2-JPush\n\n![](demo.jpg)\n[![Dependency Status](https://david-dm.org/HsuanXyz/ionic2-jpush.svg)](https://david-dm.org/HsuanXyz/ionic2-jpush)\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][downloads-url] [![MIT License][license-image]][license-url]\n\n为ionic2调用极光插件提供符合angular2及TS的调用方式\n\n说在前面：如果想使用 ionic-native 的调用方式，可以参考https://github.com/zjcboy/ionic2-jpush-demo\n\n### install\n先安装官方的cordova插件 https://github.com/jpush/jpush-phonegap-plugin.git\n\n`$ cordova plugin add jpush-phonegap-plugin --variable APP_KEY=your_jpush_appkey`\n\n在安装本库\n\n`$ npm install ionic2-jpush --save`\n\n\n### Import module\n\n```typescript\nimport { NgModule, ErrorHandler } from '@angular/core';\nimport { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';\nimport { MyApp } from './app.component';\n...\nimport { IonJPushModule } from 'ionic2-jpush'\n\n@NgModule({\n  declarations: [\n    MyApp,\n    ...\n  ],\n  imports: [\n    IonJPushModule,\n    IonicModule.forRoot(MyApp)\n  ],\n  bootstrap: [IonicApp],\n  entryComponents: [\n    MyApp,\n    ...\n  ],\n  providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}]\n})\nexport class AppModule {}\n\n```\n\n### Use\n\n```typescript\nimport 'rxjs';\nimport { Component } from '@angular/core';\nimport { Platform } from 'ionic-angular';\n...\nimport { JPushService } from 'ionic2-jpush'\n\n@Component({\n  templateUrl: 'plugins-test.html'\n\n})\nexport class PluginsTestPage {\n  constructor(\n    private platform: Platform,\n    private jPushPlugin: JPushService\n  ) {\n\n        platform.ready().then( () =\u003e{\n       \n             this.jPushPlugin.openNotification()\n               .subscribe( res =\u003e {\n                 console.log('收到推送');\n                 console.log(res)\n               });\n       \n             this.jPushPlugin.receiveNotification()\n               .subscribe( res =\u003e {\n                 console.log('收到推送');\n                 console.log(res)\n               });\n       \n             this.jPushPlugin.receiveMessage()\n               .subscribe( res =\u003e {\n                 console.log('收到推送');\n                 console.log(res)\n               });\n       \n           })\n\n     }\n\n    /**\n    * 注册极光\n    */\n   init() {\n    this.jPushPlugin.init()\n    .then(res =\u003e alert(res))\n    .catch(err =\u003e alert(err))\n    }\n\n    /**\n    * 获取ID\n    */\n    getRegistrationID() {\n     this.jPushPlugin.getRegistrationID()\n     .then(res =\u003e alert(res))\n     .catch(err =\u003e alert(err))\n     }\n     \n    /**\n    * 设置标签\n    */\n    setTags() {\n    this.jPushPlugin.setTags({\n      sequence: Date.now(),\n      tags: ['tag1', 'tag2']\n    })\n    .then((res:any) =\u003e {\n      console.log(res.tags.toString())\n    })\n    .catch(err =\u003e {\n      alert(err);\n      console.log(err)\n    })\n    }\n    \n  }\n\n```\n\n# API\n| 名称          |  参数 | 返回类型   | 描述 |\n| ------------- | ------- | ------- | ----------- |\n| setDebugMode  | boolean | Promise | 设置 debug 模式   |\n| init          | 无 | Promise | 注册极光   |\n| getRegistrationID       | 无 | Promise | 获取ID  |\n| stopPush      | 无 | Promise | 停用推送          |\n| resumePush    | 无 | Promise | 恢复推送          |\n| isPushStopped | 无 | Promise | 推送是否被停用     |\n| setTags | { sequence: number; tags: string[] }| Promise | 设置 tags |\n| addTags | { sequence: number; tags: string[] }| Promise | 添加 tags |\n| deleteTags | { sequence: number; tags: string[] }| Promise | 删除 tags |\n| cleanTags | { sequence: number }| Promise | 清除tags |\n| getAllTags | { sequence: number }| Promise | 获取所有本机设置的 tags |\n| setAlias | { sequence: number; alias: string }| Promise | 设置 alias |\n| deleteAlias | { sequence: number }| Promise | 删除 alias |\n| getAlias | { sequence: number }| Promise |获取本机设置的 alias |\n\n# IOS API\n| 名称          |  参数 | 返回类型   | 描述 |\n| ------------- | ------- | ------- | ----------- |\n| setBadge | value:number| Promise | 设置 badge 至 JPush 服务器|\n| reSetBadge | 无| Promise | 移除 JPush 服务器 badge |\n| getApplicationIconBadgeNumber | 无| Promise | 获取本地 badge |\n| setApplicationIconBadgeNumber | value:number| Promise | 设置本地 badge |\n| clearAllLocalNotifications | 无| Promise | 清除所有本地推送对象 |\n\n# Android API\n| 名称          |  参数 | 返回类型   | 描述 |\n| ------------- | ------- | ------- | ----------- |\n| clearNotificationById | id:number| Promise | 清除指定ID通知 |\n| clearAllNotification | 无 | Promise | 清除所有通知 |\n| setPushTime | days: number , startHour: number, endHour: number | Promise | 设置允许推送时间 |\n| setSilenceTime | days: number , startHour: number, endHour: number | Promise | 设置通知静默时间 |\n\n# 可订阅事件\n| 名称          |  参数 | 返回类型   | 描述 |\n| ------------- | ------- | ------- | ----------- |\n| openNotification | 无| Observable | 点击通知事件 |\n| receiveNotification | 无| Observable | 收到通知事件 |\n| receiveMessage | 无| Observable | 收到自定义消息事件 |\n| backgroundNotification | 无| Observable | 后台收到通知事件 |\n\n[npm-url]: https://www.npmjs.com/package/ionic2-jpush\n[npm-image]: https://img.shields.io/npm/v/ionic2-jpush.svg\n\n[downloads-image]: https://img.shields.io/npm/dm/ionic2-jpush.svg\n[downloads-url]: http://badge.fury.io/js/ionic2-jpush\n\n[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat\n[license-url]: LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsuanxyz%2Fionic2-jpush","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhsuanxyz%2Fionic2-jpush","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhsuanxyz%2Fionic2-jpush/lists"}