Integrate the Connect SDK into a React Native app
The Connect SDK captures visitors' interactions with mobile applications. You can integrate it into your React Native app and track the findings in the Acoustic Connect interface.
Language: TypeScript and JavaScript
Availability: Pro, Premium, and Ultimate
Scope: This guide covers integrating the Connect SDK for development and testing. For Expo, see Integrate the Connect SDK into an Expo app. For production configuration, see Move to production.
Requirements
-
Acoustic Connect subscription. You must register your app in Connect and get credentials for it (app key and collector URL). For instructions, see Generate Connect credentials for integration.
-
Development environment. React Native 0.84–0.87 with React 19.2.3–19.x. Node.js 20.19.4–20.x, 22.13–22.x or 24.3–24.x (React Native 0.87 doesn't support Node 20).
On React Native 0.82 or 0.83, you can install the previous SDK line (19.0) as shown in step 1, but it doesn't include 19.1 fixes. Upgrade to React Native 0.84 or later to get them. If you're creating a new app, create it on React Native 0.87 or earlier, for example npx @react-native-community/cli@latest init MyApp --version 0.85.3.
-
Peer dependency.
react-native-nitro-modulesat exactly the version pinned in the SDK'speerDependencies(currently 0.37.1 for SDK 19.1; 0.35.9 for SDK 19.0). A version mismatch may cause the SDK to fail at startup — even a patch release can contain breaking changes to the native registration contract. To check your resolved version:npm ls react-native-nitro-modules -
Mobile app compatibility. iOS 15.1–26.5, Android 8–16 (API 26–36). Android
compileSdk35–36 is required.
Known issues
- Session replay accuracy (iOS). Session replay on iOS may show stale screen snapshots and does not track scroll position. Android is not affected.
- Content inside a
WebViewcomponent is not captured in session replay. - Due to changes introduced in iPadOS 14, the SDK does not support iPad.
- Dual SIM features are in beta. Behavior using multiple carriers may be unreliable.
Initial setup
- From your project root, install the Connect library and its required peer dependency.
npm install react-native-acoustic-connect@^19.1.1 [email protected]npm install react-native-acoustic-connect@~19.0.34 [email protected]Running the command above automatically creates ConnectConfig.json in your project root. On Android, it also adds the required permissions (INTERNET, ACCESS_NETWORK_STATE, ACCESS_WIFI_STATE, ACCESS_FINE_LOCATION) to AndroidManifest.xml and wires android/app/build.gradle to apply the SDK's config.gradle — no manual manifest edits needed.
Location permissions on Android
On Android, the SDK can log the device's location automatically when your app has location permission, so its manifest declares ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION. These are merged into your app even if you delete the line npm install adds.
If your app doesn't need location data:
- Turn off automatic location logging: add
"LogLocationEnabled": falseto theConnectobject in ConnectConfig.json. - Remove the permissions from your app. In android/app/src/main/AndroidManifest.xml, add the
toolsnamespace to the<manifest>tag and mark both permissions for removal:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:node="remove" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" tools:node="remove" />
...
</manifest>Rebuild the app. The rest of the SDK keeps working without these permissions.
- Open ConnectConfig.json and update the following values with your credentials.
AppKey— your Connect app key.PostMessageUrl— your collector URL.KillSwitchUrl— constructed from your collector URL and app key:https://{collector_host}/collector/switch/{app_key}.
All other values in the file are set to safe defaults and do not require changes for initial integration.
- Install CocoaPods dependencies for iOS. From your project root, install the gems in your project's Gemfile once, then run CocoaPods through Bundler so it uses the version your project pins:
bundle install
cd ios && bundle exec pod install --repo-updateUse --repo-update to ensure CocoaPods fetches the latest pod specs. Omitting it can cause pod resolution failures if your local spec repo is stale. See Troubleshooting > iOS for details.
- For Android, trigger a Gradle sync in Android Studio. To avoid PATH resolution errors, open Android Studio from a terminal:
open -a "Android Studio".
WarningThe values in ConnectConfig.json are baked into the native bundles at build time, not read at runtime. If you edit the file later, run
bundle exec pod install --repo-updateagain on iOS and trigger a Gradle sync on Android before rebuilding.
- Wrap your app in
<Connect>(recommended). It tracks screen changes for you. Add it to your app's root component (typically App.tsx). If you can't use it, follow the Manual screen tracking tab and callsetCurrentScreenNamein each screen.
<Connect> wraps your existing JSX — it does not replace your root component structure.
Add useNavigationContainerRef to your existing @react-navigation/native import. If NavigationContainer is not already imported in this file, add it too. Then add the Connect import and update your component as shown below.
import { NavigationContainer } from '@react-navigation/native'
export default function App() {
return (
<NavigationContainer>
{/* your screens */}
</NavigationContainer>
)
}import { useNavigationContainerRef, NavigationContainer } from '@react-navigation/native'
import { Connect } from 'react-native-acoustic-connect'
export default function App() {
const navigationRef = useNavigationContainerRef()
return (
<Connect
navigationRef={navigationRef}
captureKeyboardEvents={true}
>
<NavigationContainer ref={navigationRef}>
{/* your screens */}
</NavigationContainer>
</Connect>
)
}Pass navigationRef from useNavigationContainerRef() as an explicit prop to both <Connect> and <NavigationContainer>.
Use this approach if your app uses a different navigation library or no navigation library at all. Import the SDK's default export and call setCurrentScreenName from each screen component.
import AcousticConnectRN from 'react-native-acoustic-connect'
function HomeScreen() {
AcousticConnectRN.setCurrentScreenName('HomeScreen')
// ...
}Call setCurrentScreenName in each screen's component body, before return. Nothing is sent until the user interacts with the app.
- Validate your configuration (recommended).
npx acoustic-connect doctordoctor checks the things that otherwise fail late and confusingly at build time:
- Node.js version
- ConnectConfig.json values (
AppKey,PostMessageUrl,KillSwitchUrl) - App identifiers (Android
namespaceandapplicationId) - Android push:
google-services.jsonmatches your package name - iOS push: entitlements, App Group, team ID and an Apple Development signing certificate
When PushEnabled is true, missing push setup is reported as a failure. When it's false, push items are skipped or shown as warnings. Add --require-push to fail on missing push setup even when push is off.
It's safe to re-run any time you change ConnectConfig.json.
Verify the SDK is running
Build and run your app. The SDK auto-initializes at module load using the values from ConnectConfig.json. With "useRelease": false in your config (the default), the debug-capable SDK build is available, and verbose native logging from the SDK's native modules — Connect, Tealeaf, and EOCore — can be written to the Xcode console and Logcat. Confirm that the SDK is initializing, capturing screen views, and posting to the collector.
Use the app for a minute: switch screens and tap a few controls. The SDK sends nothing until something happens in the app.
- iOS: each successful post logs
Posting : …/collector/collectorPostin the Xcode console, followed by a response withStatus Code: 200. The SDK also sends any queued data when the app goes to the background. - Android: look for
Http status: 200 from url: …/collector/collectorPostunder theEOCoretag in Logcat, about every 30 seconds.
A new session may take some time to appear in Connect.
Enable debug logging
With "useRelease": false (the default), verbose native logging is on automatically and appears in the Xcode console. You don't need to add anything to your Xcode scheme. Setting useRelease to true for production turns it off; see Move to production.
To read the logs outside Xcode, open Console.app, select the simulator or device, and filter by your app's name.
Verbose logging is on by default — no equivalent setup step needed. Filter Logcat by the tags AcousticConnectRN and EOCore to isolate SDK output. To reduce or disable it, set DisplayLogging and LoggingLevel under the Connect object in ConnectConfig.json, then trigger a Gradle sync.
If you have a Connect Ultimate subscription, you can also verify the integration visually: open Behavior studio > Sessions > Session replay and confirm that your session appears and renders correctly.
Troubleshooting
npm install peer-dependency conflict on react-native-nitro-modules
npm install peer-dependency conflict on react-native-nitro-modulesThe SDK pins react-native-nitro-modules to an exact version, so npm install fails with ERESOLVE if your project resolves a different one. Install the exact version the error names, together with the SDK, as shown in step 1. Check the resolved version with npm ls react-native-nitro-modules.
Using --legacy-peer-deps or --force silences the error but does not resolve the underlying mismatch; a version conflict can cause the SDK to fail at startup.
ConnectConfig.json not created after npm install
npm installThe file is created by a postinstall script that only runs when npm actually installs packages. If the SDK was already listed in package.json before you ran npm install, npm may skip the script with an "up to date" message. To create the file manually, run:
node node_modules/react-native-acoustic-connect/scripts/postinstall.mjspod install fails with cannot load such file -- kconv
pod install fails with cannot load such file -- kconvRuby 3.4 and later no longer include the nkf gem by default, and CocoaPods still needs it. Add this line to your Gemfile:
gem 'nkf'Then run bundle install from your project root, and bundle exec pod install --repo-update from ios/.
pod install fails with [Connect] requires AcousticConnect >= 2.0.5
pod install fails with [Connect] requires AcousticConnect >= 2.0.5You have an older iOS pod version pinned in ConnectConfig.json. Set "iOSVersion" to an empty string to use the latest available version, then bundle exec pod install --repo-update.
pod install fails with CocoaPods could not find compatible versions
pod install fails with CocoaPods could not find compatible versionsYour local CocoaPods spec repo is stale. Always run bundle exec pod install --repo-update rather than bundle exec pod install to ensure the latest pod specs are fetched.
Connect: navigation tracking disabled — no usable NavigationContainer ref resolved
Connect: navigation tracking disabled — no usable NavigationContainer ref resolvedThis warning may appear at startup when NavigationContainer is nested inside other providers rather than being a direct child of <Connect>. Screen tracking works correctly despite the warning — it does not indicate a loss of functionality.
pod install fails with [Xcodeproj] Unable to find compatibility version string for object version 'N'
pod install fails with [Xcodeproj] Unable to find compatibility version string for object version 'N'The xcodeproj gem does not yet support the project format version used by your installed Xcode. This can occur any time Xcode ships a new format version before the xcodeproj gem has been updated to match — including between minor Xcode updates.
If you run CocoaPods without Bundler, first check whether a compatible version of the gem is now available:
gem update xcodeproj
pod install --repo-updateIf the gem has not been updated yet, build xcodeproj from source as a temporary workaround:
git clone https://github.com/CocoaPods/Xcodeproj.git /tmp/xcodeproj
cd /tmp/xcodeproj
gem build xcodeproj.gemspec
gem install xcodeproj-*.gem --localThen re-run pod install --repo-update. Once CocoaPods publishes a compatible gem release, revert to the released version with gem update xcodeproj.
xcodebuild requires Xcode, but the active developer directory is a command line tools instance
xcodebuild requires Xcode, but the active developer directory is a command line tools instanceThe command line is using the Command Line Tools instead of Xcode. Point it at Xcode:
sudo xcode-select -s /Applications/Xcode.app/Contents/DeveloperIf you don't have admin rights, add this line to your shell profile (for example ~/.zshrc) instead, then open a new terminal:
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/DeveloperGradle fails to resolve io.github.go-acoustic:connect
io.github.go-acoustic:connectThe SDK requires an Android Connect artifact in the range [11.0.11, 12.0.0). If Gradle rejects your pinned version, set "AndroidVersion" in ConnectConfig.json to an empty string and re-sync.
Gradle cannot find node or npx
node or npxThis occurs when Gradle is launched outside a shell where your Node installation is active — most commonly when Android Studio is opened from the Dock rather than from a terminal.
Recommended fix: Open Android Studio from a terminal so it inherits your shell's PATH:
open -a "Android Studio"Then re-trigger the Gradle sync. If you need to run ./gradlew clean from the terminal directly, prefix the command with the PATH fix:
PATH="/usr/local/bin:$PATH" ./gradlew cleanAlternative: Create symlinks so Gradle can resolve both binaries from a stable system path regardless of how Android Studio is launched. Use the path that matches your machine:
sudo ln -sf "$(which node)" /opt/homebrew/bin/node
sudo ln -sf "$(which npx)" /opt/homebrew/bin/npxsudo ln -sf "$(which node)" /usr/local/bin/node
sudo ln -sf "$(which npx)" /usr/local/bin/npxVerify that the symlink targets exist before running these commands — if which npx resolves to a broken symlink, the commands above will not fix the issue.
Manifest merger failed: minSdkVersion too low
minSdkVersion too lowThe React Native template sets minSdkVersion 24 by default, which is below the Connect SDK's minimum of API 26. The build fails with:
Manifest merger failed : uses-sdk:minSdkVersion 24 cannot be smaller than version 26
declared in library [io.github.go-acoustic:connect:...]In android/build.gradle, set minSdkVersion to at least 26:
minSdkVersion = 26SDK initializes but no session appears in Connect
The kill switch may be returning "die". Check the native log for KillSwitch Responded with 0 and killswitch : says die. The most likely cause is that PostMessageUrl points to a different collector node than the one where your app is registered. Verify the collector URL in your Connect account and update PostMessageUrl in ConnectConfig.json to match, then run bundle exec pod install --repo-update on iOS (and Gradle sync on Android) and rebuild.
Next steps
- Identify users at registration — send the account registered signal to associate sessions with contacts in Connect.
- Identify users at sign-in — send the logged in signal to attribute sessions to known contacts.
- Push notifications in a React Native app — set up push for iOS and Android.
- Move to production — disable verbose logging and prepare your app for release.
Updated 19 days ago
