Ionic SDK

Overview

Reteno for Ionic uses the cordova-plugin-reteno plugin with the Ionic Native wrapper package awesome-cordova-plugins-reteno.

Supported stack
  • Ionic app with Cordova runtime
  • iOS 15.0+
  • Android with cordova-android >= 12.0.0

Install Plugin and Wrapper

1. Install Cordova plugin

ionic cordova plugin add cordova-plugin-reteno --variable SDK_ACCESS_KEY=YOUR_KEY

2. Install wrapper (awesome-cordova-plugins-reteno)

Pick the wrapper major version that matches your installed @awesome-cordova-plugins/core
(the core package tracks Ionic ecosystem majors). The core runtime API is consistent across
v5–v9. Newer wrapper releases may add TypeScript declarations for fields supported by the
Cordova plugin. For example, [email protected] adds the marketId
declaration.

Wrapper version@awesome-cordova-plugins/coreInstall
awesome-cordova-plugins-reteno@5^5.45.0npm install awesome-cordova-plugins-reteno@5 @awesome-cordova-plugins/core@5
awesome-cordova-plugins-reteno@6^6.16.0npm install awesome-cordova-plugins-reteno@6 @awesome-cordova-plugins/core@6
awesome-cordova-plugins-reteno@7^7.0.1npm install awesome-cordova-plugins-reteno@7 @awesome-cordova-plugins/core@7
awesome-cordova-plugins-reteno@8^8.1.0npm install awesome-cordova-plugins-reteno@8 @awesome-cordova-plugins/core@8
awesome-cordova-plugins-reteno@9^9.1.2npm install awesome-cordova-plugins-reteno@9 @awesome-cordova-plugins/core@9

If you already have @awesome-cordova-plugins/core installed, keep that major and install the matching wrapper:

# Example: core already at v8 — install wrapper v8
npm install awesome-cordova-plugins-reteno@8

Fresh install of latest:

npm install awesome-cordova-plugins-reteno @awesome-cordova-plugins/core

3. Register provider

import { AwesomeCordovaPluginReteno } from 'awesome-cordova-plugins-reteno';

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

Initialize the SDK

Call init(...) after Platform.ready():

import { Platform } from '@ionic/angular';
import { AwesomeCordovaPluginReteno } from 'awesome-cordova-plugins-reteno';

constructor(
  private platform: Platform,
  private reteno: AwesomeCordovaPluginReteno,
) {
  this.platform.ready().then(async () => {
    await this.reteno.init({
      isDebugMode: false,
      pauseInAppMessages: false,
      pausePushInAppMessages: false,
      inAppMessagesPauseBehaviour: 'POSTPONE_IN_APPS',
      lifecycleTrackingOptions: {
        appLifecycleEnabled: true,
        foregroundLifecycleEnabled: false,
        pushSubscriptionEnabled: true,
        sessionStartEventsEnabled: true,
        sessionEndEventsEnabled: true,
      },
      sessionDurationSeconds: 30 * 60,
      isAutomaticScreenReportingEnabled: false, // iOS only
    });
  });
}

Options reference

All fields are optional.

OptionTypeiOSAndroidNotes
accessKeystringOverrides SDK_ACCESS_KEY from config.xml. Usually not needed.
isDebugModebooleanEnables near real-time event monitoring for test devices.
pauseInAppMessagesbooleanStart SDK with in-app messages paused.
pausePushInAppMessagesbooleanAndroid-only. Safe to pass on iOS (ignored).
inAppMessagesPauseBehaviour'SKIP_IN_APPS' | 'POSTPONE_IN_APPS'iOS-only via init(). On Android use runtime method in In-AppMessages.
isAutomaticScreenReportingEnabledbooleaniOS-only. Not recommended in hybrid WebView apps; use logScreenView() manually.
lifecycleTrackingOptionsobject | 'ALL' | 'NONE'See App Lifecycle Events. On iOS, set before/inside init().
sessionDurationSecondsnumberOptional session reset duration (Android 2.9.4+, iOS 2.7.0+)

Access key

Recommended: set SDK_ACCESS_KEY in config.xml (or via ionic cordova plugin add --variable SDK_ACCESS_KEY=...). The plugin reads it automatically, so passing accessKey in JS is optional.

Calling init() multiple times

init() is idempotent: after first successful call, next calls resolve immediately without re-initializing native SDK. Options from later calls are ignored.

TypeScript Types

All payload and response types are exported from the wrapper package. Prefer them over any for better autocompletion and type safety:

import {
  AwesomeCordovaPluginReteno,
  RetenoInitializeOptions,
  UserAttributes,
  UserAttributesAnonymous,
  SetUserAttributesPayload,
  LogEventPayload,
  LogEcommerceEventPayload,
  NotificationPresentationOption,
  InAppLifecyclePayload,
  AppInboxMessage,
  AppInboxMessages,
  GetRecommendationsPayload,
  RecommendationsResponse,
  RetenoPushButtonClickedPayload,
} from 'awesome-cordova-plugins-reteno';

Setup Guides

Capacitor developers should use the dedicated sections inside platform setup guides:

Feature guides

Licence

Reteno Cordova plugin is released under MIT. See LICENSE.