Cordova SDK Setup

Overview

Reteno is a plugin for Cordova that helps mobile teams integrate Reteno into their mobile apps.

The plugin supports:
  • Cordova 10.2 or later
  • iOS 15.0 or later
  • Android with cordova-android >= 12.0.0

Getting Started with Reteno Plugin / Setup Guide

Initialize the SDK

RetenoPlugin.init(...) must be called after Cordova's native bridge is ready. Call it from the deviceready listener.

Cordova (vanilla JS)

document.addEventListener('deviceready', onDeviceReady, false);

function onDeviceReady() {
  RetenoPlugin.init({
    isDebugMode: false,
    pauseInAppMessages: false,
    pausePushInAppMessages: false,                // Android only
    inAppMessagesPauseBehaviour: 'POSTPONE_IN_APPS', // iOS only: 'SKIP_IN_APPS' | 'POSTPONE_IN_APPS'
    isAutomaticScreenReportingEnabled: false,     // iOS only
    lifecycleTrackingOptions: {                   // or 'ALL' / 'NONE'
      appLifecycleEnabled: true,
      foregroundLifecycleEnabled: false,
      pushSubscriptionEnabled: true,
      sessionStartEventsEnabled: true,
      sessionEndEventsEnabled: true,
    },
    sessionDurationSeconds: 30 * 60,              // Android 2.9.4+, iOS 2.7.0+
  })
    .then(() => console.log('Reteno initialized'))
    .catch((err) => console.error('init: ERROR', err));
}

Options reference

All fields are optional.

OptionTypeiOSAndroidNotes
accessKeystringOverrides SDK_ACCESS_KEY from config.xml. Usually not needed — see "Access key" below.
isDebugModebooleanEnables near real-time event monitoring. Use only on test devices.
pauseInAppMessagesbooleanStart the 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 setInAppMessagesPauseBehaviour at runtime.
isAutomaticScreenReportingEnabledbooleaniOS-only. Not recommended in Cordova — use logScreenView() manually.
lifecycleTrackingOptionsobject | 'ALL' | 'NONE'See App Lifecycle Events. iOS: only via 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 cordova plugin add --variable SDK_ACCESS_KEY=...). The plugin reads it automatically — no need to pass accessKey in JS.

Only pass accessKey in init() when you need to override the value from config.xml at runtime.

Calling init() multiple times

init() is idempotent — the plugin caches the first successful initialization and subsequent calls resolve immediately without re-initializing the native SDK. Options passed to later calls are ignored.

Feature Guides

Licence

Reteno Cordova Plugin is released under the MIT license. See LICENSE for details.