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

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)

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.

  1. In the app-level build.gradle file, update the dependencies block to include the Connect SDK.
dependencies {
    implementation "io.github.go-acoustic:connect:11.0.11"
}
  1. Synchronize the project.

  2. Initialize the SDK in your Application subclass. 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"
        )
    }
}
📘

Note

This inline pattern gets you running quickly during integration. Before you ship, move your credentials out of your Application subclass and split them by build type — see Move your Android integration to production.

  1. Add the gesture hook to your base activity.
override fun dispatchTouchEvent(e: MotionEvent?): Boolean {
    Connect.dispatchTouchEvent(this, e)
    return super.dispatchTouchEvent(e)
}
  1. 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 and EOCore 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