DevRev SDK for Cordova

Quickstart guide

This guide helps you integrate the DevRev SDK into your Cordova app.

Requirements

  • Cordova 12.0 or later.
  • Android: minimum API level 24.
  • iOS: minimum deployment target 15.0.
  • Recommended: an SSH key configured locally and registered with GitHub.

Install

To install the DevRev SDK, run the following command:

cordova plugin add @devrev/sdk-cordova

Set up the DevRev SDK

  1. Open the DevRev web app at https://app.devrev.ai and go to the Settings page.
  2. Under PLuG settings, copy the value under Your unique App ID.
  3. Configure the DevRev SDK in your app using the obtained credentials.

The DevRev SDK must be configured before you can use any of its features.

The SDK becomes ready for use once the configuration API is executed.

DevRev.configure(appID, successCallback, errorCallback)

To provide a feature configuration during setup, call the overload that accepts it:

DevRev.configure(appID, featureConfiguration, successCallback, errorCallback)

For default behavior, call the simpler form:

DevRev.configure(appID, function() {
    console.log('DevRev SDK configured successfully.');
}, function(error) {
    console.error('Failed to configure DevRev SDK:', error);
});

To customize behavior such as frame capture, auto-start recording, or theme preferences, pass a full FeatureConfiguration object:

DevRev.configure(appID, {
    enableFrameCapture: false,
    autoStartRecording: false,
    prefersDialogMode: false,
    alwaysUseRemoteConfig: true,
    supportWidgetTheme: {
        prefersSystemTheme: true,
    },
}, function() {
    console.log('DevRev SDK configured with FeatureConfiguration.');
}, function(error) {
    console.error('Failed to configure DevRev SDK:', error);
});

Update the feature configuration

You can adjust the feature configuration without reconfiguring the SDK. Pass a full FeatureConfiguration object (all properties are required):

DevRev.updateFeatureConfiguration({
    enableFrameCapture: true,
    autoStartRecording: true,
    prefersDialogMode: false,
    alwaysUseRemoteConfig: true,
    supportWidgetTheme: {
        prefersSystemTheme: true,
    },
}, function() {
    console.log('Feature configuration updated.');
}, function(error) {
    console.error('Failed to update feature configuration:', error);
});

Feature configuration reference

FeatureConfiguration controls how the SDK behaves both during initial setup and when calling DevRev.updateFeatureConfiguration(...). All properties are required when providing a feature configuration.

PropertyTypeDefaultDescription
enableFrameCapturebooleantrueEnables the screen capture pipeline used by session replay.
autoStartRecordingbooleantrueAutomatically starts recording after the SDK finishes remote configuration.
prefersDialogModebooleanfalsePrefer dialog mode for the support UI (Android only).
alwaysUseRemoteConfigbooleantrueAlways use remote config.
supportWidgetThemeSupportWidgetThemeControls the appearance of the in-app support widget, including dynamic theme behavior.

Support widget theme options

SupportWidgetTheme lets you fine-tune the support UI. Use the supportWidgetTheme property inside your feature configuration.

var customTheme = {
    prefersSystemTheme: false,
    primaryTextColor: '#1F2933',
    accentColor: '#F97316',
    spacing: {
        bottom: '20px',
        side: '16px'
    }
};
PropertyTypeDefaultDescription
prefersSystemThemebooleantrueFollows the device appearance when true; otherwise uses your custom colors.
primaryTextColorstring?Hex color string (for example, '#000000', '#1F2933') for primary text in the support widget.
accentColorstring?Hex color string (for example, '#F97316', '#FF0000') applied to buttons and highlights.
spacing{ [key: string]: string }?CSS-like overrides (bottom and side keys are recognized).

Sample app

A sample app with use cases for the DevRev Cordova plugin is provided as part of our public repository. To set up and run the sample app:

cd sample
npm install
cordova platform add android
cordova platform add ios
cordova run android

OR open platforms/android in Android Studio and run the app.

  1. Open platforms/ios/Podfile and ensure it contains:
platform :ios, '15.0'
  1. Install dependencies:
cd platforms/ios
pod install
  1. Run the app:
cordova run ios

OR open DevRevSDKSample.xcworkspace in Xcode and run the app.

Last updated on