Giter Site home page Giter Site logo

ionic-jpush's Introduction

如何使用

  1. 安装官方Cordova插件
ionic plugin add jpush-phonegap-plugin --variable APP_KEY=your_jpush_appkey
  1. 安装模块ionic3-jpush
npm i ionic3-jpush -S
  1. app.module.ts中引入,并加入到@NgModuleproviders
import { JPush } from 'ionic3-jpush';

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

  1. 在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)
    })

  }
}

Api说明

实现方法

因项目需求只实现了目前项目中使用到的方法,如需更多方法请提交issue

  • init(): Promise;
  • stopPush(): Promise;
  • resumePush(): Promise;
  • isPushStopped(): Promise;
  • getRegistrationID(): Promise;
  • setTagsWithAlias(tags?: string[], alias?: string): Promise;
  • setTags(tags?: string[]): Promise;
  • setAlias(alias?: string): Promise;
  • setBadge(badgeNum?: number): Promise;
  • getUserNotificationSettings(): Promise;
  • openNotification(): Observable;
  • receiveNotification(): Observable;
  • receiveMessage(): Observable;

v1.1.0 update iOS Api

  • setApplicationIconBadgeNumber(badgeNum?: number): Promise;
  • getApplicationIconBadgeNumber(): Promise;
  • addLocalNotificationForIOS(option: LocalNotificationOption): Promise;
  • deleteLocalNotificationWithIdentifierKeyInIOS(identifierKey: String): Promise;
  • clearAllLocalNotifications(): Promise;
  • setLocation(latitude: String | Number, longitude: String | Number): Promise;
  • isPlatformIOS(): Promise;
  • addDismissActions(actions: any, categoryId: String): Promise;
  • addNotificationActions(actions: any, categoryId: String): Promise;

ionic-jpush's People

Contributors

lh4111 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.