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
gradlebinary and make sure it's onPATH, orcordova-androidcannot bootstrap the project's Gradle wrapper.
Initial setup
- Add the plugin to your Cordova project. This registers it under the Cordova plugin ID
co.acoustic.connect.pushand addswindow.AcousticConnectto your app's JavaScript context.
npx cordova plugin add cordova-acoustic-connect- 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
| Field | Description |
|---|---|
AppKey | Required. Your Connect application key. |
PostMessageUrl | Required. Your Connect collector endpoint. |
useRelease | Keep the default false to enable verbose native logging. Switch to true when you finish testing. |
-
Add ConnectConfig.json to
.gitignoreto keep your credentials safe. -
Add platforms and build. On iOS,
npx cordova preparerunspod 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- Call
AcousticConnect.enable()from yourdevicereadyhandler, 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
useReleaseafter initial setup. A plaincordova prepareorcordova buildwill not pick up a newuseReleasevalue. 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 callingenable()from JS. iOS has no equivalent native auto-init; callenable()explicitly on every platform.
Troubleshooting
pod install / npx cordova build ios fails: command not found: pod
pod install / npx cordova build ios fails: command not found: podCocoaPods 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
AcousticConnect / AcousticConnectDebugYour 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
xcode-select error about Command Line ToolsCommon 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.
