ionic3 极光推送

极光推送
官网:https://www.jiguang.cn/push
注册账号,创建应用,记录AppKey, 应用包名与ioinic 包名一致(config.xml 下 widget 的id)

ionic 安装
cordova plugin add jpush-phonegap-plugin --variable APP_KEY=your_jpush_appkey

安装 npm install --save @jiguang-ionic/jpush

在 app.module.ts 文件中,导入,然后添加到 服务(providers)中。

import { JPush } from '@jiguang-ionic/jpush';
...
  providers: [
    ...
    JPush,
    ...
  ]

app.component.ts

import { JPush } from '@jiguang-ionic/jpush' // 极光推送

constructor(
  platform: Platform,
  splashScreen: SplashScreen,

  jpush:JPush
) {
  platform.ready().then(() => {
    splashScreen.hide()
    jpush.init();
    jpush.setDebugMode(true);
  })
  
}

你可能感兴趣的:(ionic3 极光推送)