OneSignal

Contents

The OneSignal plugin is an client implementation for using the OneSignal Service. OneSignal is a simple implementation for delivering push notifications.

https://github.com/OneSignal/OneSignal-Cordova-SDK

Ionic OneSignal插件的安装(Installation)

ionic cordova plugin add onesignal-cordova-plugin npm install @ionic-native/onesignal

Ionic OneSignal插件支持的平台(Supported Platforms)

  • Amazon Fire OS
  • Android
  • iOS
  • Windows

Ionic OneSignal插件的用法(Usage)

import { OneSignal } from '@ionic-native/onesignal';

constructor(private oneSignal: OneSignal) { }

...

this.oneSignal.startInit('b2f7f966-d8cc-11e4-bed1-df8f05be55ba', '703322744261');

this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.InAppAlert);

this.oneSignal.handleNotificationReceived().subscribe(() => {
 // do something when notification is received
});

this.oneSignal.handleNotificationOpened().subscribe(() => {
  // do something when a notification is opened
});

this.oneSignal.endInit();