Integrate the Connect SDK into a native Android app (View-based)
The Connect SDK is a library that captures visitors' interactions with mobile applications. You can integrate the library into your native Android app built with the View system and track the findings in the Acoustic Connect interface.
Languages: Kotlin and Java
Availability: Pro, Premium, and Ultimate
Scope: This guide covers integrating the Connect SDK for development and testing. For production configuration, see Prepare the Connect library for production use on Android devices.
Requirements
- Acoustic Connect subscription. You must register your app in Connect and get credentials for it (app key and collector URL). For instructions, see Connect mobile apps in the user guide.
- Development environment. Android Studio.
- Mobile app compatibility. Android 8.0 (API level 26) to Android 16 (API level 36)
Known issues
- Dialogs and bottom sheets are not captured in session replay.
AlertDialogandBottomSheetDialogFragmentare not supported — their layout, interactions, and gestures are not logged. Standard Activity and Fragment screens are not affected. - Text change events are not supported. Input is captured when a field loses focus, not as the user types. The final value entered is recorded, but character-by-character editing and correction behavior are not.
- User interactions on screens that close programmatically are not captured. When an Activity calls
finish()to dismiss itself, any queued interaction events are lost before they can be flushed to the collector. Gestures and input from these screens are not transmitted. - Mixed View and Compose apps may not work correctly. The SDK is tested and supported for apps that use the View system exclusively. Apps that mix the View system and Jetpack Compose may experience unpredictable behavior including missed captures, incorrect layout hierarchy, or gestures not logging correctly. For Compose apps, use the Connect SDK for Jetpack Compose instead.
Prerequisites
Before you start the integration, make sure AndroidManifest.xml has the following permissions:
<!-- Required permissions -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<!-- Recommended permissions: location -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>Initial setup
Add the Connect SDK dependency to your project.
- In the app-level build.gradle file, update the
dependenciesblock to include the Connect SDK.
dependencies {
implementation "io.github.go-acoustic:connect:11.0.11"
}-
Synchronize the project.
-
Initialize the SDK in your
Applicationsubclass. Replace the placeholders with your Connect credentials.
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
Connect.init(this)
Connect.enable(
appKey = "YOUR_APP_KEY",
postMessageUrl = "YOUR_COLLECTOR_URL"
)
}
}
NoteThis inline pattern gets you running quickly during integration. Before you ship, move your credentials out of your
Applicationsubclass and split them by build type — see Move your Android integration to production.
- Add the gesture hook to your base activity.
override fun dispatchTouchEvent(e: MotionEvent?): Boolean {
Connect.dispatchTouchEvent(this, e)
return super.dispatchTouchEvent(e)
}- Build and run your app to verify the integration.
Verify the SDK is running
The Connect Android library ships with verbose logging enabled by default. Once you complete the integration steps above, run your app and open Logcat in Android Studio. Filter for the tags Tealeaf , EOCore and Connect to confirm the SDK is initializing, capturing screens, and posting to the collector.
Verbose logging is convenient during integration but should be disabled before you ship. For instructions, see Prepare the Connect library for production use on Android devices.
Next steps
- Identify users at sign-in — send a logged in signal after authentication so Connect can match the app visitor to a known contact.
- Identify users at registration — send an account registered signal after sign-up to create or match a contact from their first session.
