CleverPush Developer Docs

CleverPush Developer Docs

  • API Reference

›Cordova SDK

JavaScript SDK

  • Setup
  • Methods

iOS SDK

  • Setup
  • Methods

Android SDK

  • Setup
  • Methods
  • Notification Extender Service

Cordova SDK

  • Setup
  • Methods

React Native SDK

  • Setup
  • Methods

Xamarin SDK

  • Setup
  • Methods

Flutter SDK

  • Setup
  • Methods

Methods

Usage

Add the initialization code to your index.js file

document.addEventListener('deviceready', function () {
   var notificationReceivedCallback = function(data) {
     console.log('notificationReceivedCallback:', JSON.stringify(data));
   };

   var notificationOpenedCallback = function(data) {
     console.log('notificationOpenedCallback:', JSON.stringify(data));
   };

   var subscribedCallback = function(subscriptionId) {
     console.log('subscriptionId:', subscriptionId);
   };

   window['plugins'].CleverPush.init("INSERT_YOUR_CHANNEL_ID", notificationReceivedCallback, notificationOpenedCallback, subscribedCallback);
}, false);

Be sure to replace INSERT_YOUR_CHANNEL_ID with your CleverPush channel ID (can be found in the channel settings).

If you are using Ionic, you can use platform.ready() instead of deviceready like this:

import { Component } from '@angular/core';
import { Platform } from '@ionic/angular';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html'
})
export class AppComponent {
  constructor(
    private platform: Platform
  ) {
    this.initializeApp();
  }

  initializeApp() {
    this.platform.ready().then(() => {
      ...

      window['plugins'].CleverPush.init("INSERT_YOUR_CHANNEL_ID", ...);
    });
  }
}
← SetupSetup →
SDKs
JavaScriptiOSAndroidCordovaReact NativeXamarinFlutter
Community
TwitterFacebookGitHub
More
BlogImprintPrivacy PolicyTerms of service
Copyright © 2021 CleverPush