Integrate the Connect library into a View-based Android app

The Connect SDK is a library that captures visitors' interactions with mobile applications. You can integrate the library into a native Android app using the View system and track the findings in the Acoustic Connect interface.

📘

New to Connect?

Install our preconfigured sample app and explore the implementation faster.

Requirements

  • Acoustic Connect. To use the Connect SDK, your company must have an active Connect subscription. Proper credentials are required for each app. For instructions, see Generate Connect credentials for integration.
  • Development environment. To integrate the library into a native Android app, you need Android Studio.
  • Mobile app compatibility. The library can capture user experience data on end users' devices running Android 5.0 (API level 21) and later.

General guidelines

It is important that you assign unique IDs to all UI controls that you want to capture.

Prerequisites

Before you get down to the integration, make sure the AndroidManifest.xml has the following required 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

  1. In the app-level build.gradle file, edit the dependencies section to support the Connect SDK.
dependencies {
  implementation("io.github.go-acoustic:connect:10.4.28")
}
  1. Synchronize the project.
  2. To initialize the library, add the following snippet to the Activity class. Replace 855e660c38824b4680602c6ac2a00zzz with your application key and https://lib-us-2.brilliantcollector.com/collector/collectorPost with your endpoint URL.
// Initialize Connect SDK
Connect.init(application)
// Enable Connect SDK
Connect.enable(
    "855e660c38824b4680602c6ac2a00zzz",
    "https://lib-us-2.brilliantcollector.com/collector/collectorPost"
)
  1. Add the Gesture hook to Base Activity.
override fun dispatchTouchEvent(e: MotionEvent?): Boolean {
    Connect.dispatchTouchEvent(this, e)
    return super.dispatchTouchEvent(e)
}
  1. Build and run your app.

Further steps