How to use

  1. Install the official Cordova plug-in
ionic plugin add jpush-phonegap-plugin --variable APP_KEY=your_jpush_appkey
Copy the code
  1. Install the moduleionic3-jpush
npm i ionic3-jpush -S
Copy the code
  1. inapp.module.ts, and add to@NgModuletheproviders
import { JPush } from 'ionic3-jpush';

@NgModule({
  ...
  providers: [ JPush ],
})
export class AppModule { }

Copy the code
  1. Call methods in Component
/ /... import { JPush } from 'ionic3-jpush'; @Component({ template: ` <ion-nav [root]="rootPage"></ion-nav>` }) export class MyApp { constructor (public jPush: JPush){ this.jPush.getRegistrationID().then(regid => { console.log(regid) }) } }Copy the code