Integrate the Connect SDK into a Cordova app

You can integrate the Connect SDK into your Cordova app and get it running on iOS and Android through one JavaScript API.

Language: JavaScript, with TypeScript definitions

Availability: Pro, Premium, and Ultimate

Scope: This guide covers installing the plugin and getting the SDK running for development and testing. For push notification setup, see iOS and Android.


Requirements

  • Acoustic Connect subscription. Register your app in Connect and get an app key and collector URL. See Generate Connect credentials for integration.
  • Development environment. Node.js 20 or later, Cordova CLI 12.0.0 or later (npm install -g cordova).
  • iOS: cordova-ios 7.0.0 or later, Xcode 15 or later, and CocoaPods (sudo gem install cocoapods). iOS deployment target 15.1 or later.
  • Android: cordova-android 13.0.0 or later, Android Studio with SDK 34 or later, JDK 17. Recent Android Studio releases (Giraffe and later) ship the Gradle IntelliJ plugin only — install a standalone gradle binary and make sure it's on PATH, or cordova-android cannot bootstrap the project's Gradle wrapper.

Initial setup

  1. Add the plugin to your Cordova project. This registers it under the Cordova plugin ID co.acoustic.connect.push and adds window.AcousticConnect to your app's JavaScript context.
npx cordova plugin add cordova-acoustic-connect
  1. Create ConnectConfig.json at your Cordova project root. Add your Connect credentials to the file.
{
  "Connect": {
    "AppKey": "<your-app-key>",
    "PostMessageUrl": "<your-collector-url>",
    "useRelease": false
  }
}
ConnectConfig.json field reference
FieldDescription
AppKeyRequired. Your Connect application key.
PostMessageUrlRequired. Your Connect collector endpoint.
useReleaseKeep the default false to enable verbose native logging. Switch to true when you finish testing.
  1. Add ConnectConfig.json to .gitignore to keep your credentials safe.

  2. Add platforms and build. On iOS, npx cordova prepare runs pod install — no need to do it yourself, unless CocoaPods reports a stale spec repo (see Troubleshooting).

npx cordova platform add ios
npx cordova platform add android
npx cordova prepare
  1. Call AcousticConnect.enable() from your deviceready handler, before any other plugin method.
document.addEventListener('deviceready', async function () {
  await AcousticConnect.enable(
    'your-app-key',
    'https://your-collector-url'
  );
}, false);

Verify the SDK is running

Build and run your app.

With "useRelease": false in ConnectConfig.json (the default), the plugin sets CONNECT_DEBUG, TLF_DEBUG, and EODebug environment variables at runtime, and verbose native logging from the SDK's Connect, Tealeaf, and EOCore modules is written to the Xcode console. Confirm the SDK is initializing and, once you call enable(), that AcousticConnect.enable() resolves without error.


Things to know

  • Changing useRelease after initial setup. A plain cordova prepare or cordova build will not pick up a new useRelease value. Remove and re-add the plugin instead:

    npx cordova plugin rm co.acoustic.connect.push
    npx cordova plugin add cordova-acoustic-connect
  • Android auto-initializes; iOS doesn't. Android additionally auto-initializes the SDK from the bundled native config at app launch if enable() hasn't been called yet — a safety net, not a replacement for calling enable() from JS. iOS has no equivalent native auto-init; call enable() explicitly on every platform.


Troubleshooting

pod install / npx cordova build ios fails: command not found: pod

CocoaPods isn't installed. Run sudo gem install cocoapods && pod repo update. On Apple Silicon, an outdated ffi gem can also break pod install — if gem install cocoapods itself fails, try sudo gem install ffi.

Undefined symbols / "Framework not found Pods_App" at build time

You opened platforms/ios/App.xcodeproj instead of the CocoaPods-generated workspace. Always open platforms/ios/App.xcworkspace after npx cordova prepare ios / npx cordova build ios.

CocoaPods platform-compatibility error naming AcousticConnect / AcousticConnectDebug

Your project's deployment-target is set below the SDK's minimum (iOS 15.0; the plugin defaults to 15.1). Remove any config.xml override below 15.1, or raise it to at least 15.1.

xcode-select error about Command Line Tools

Common on a machine where the standalone Command Line Tools got installed before Xcode.app — for example, via a git or Homebrew prompt. xcode-select's active developer directory ends up pointed at the Command Line Tools instead of Xcode.app, and npx cordova build ios fails because it shells out to xcodebuild, which needs the full Xcode install. Check with xcode-select -p; fix with sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer.