SDK Integration

📘

Supported Android versions

Fully supported on Android Lollipop (API 21)

You can integrate Smartlook on Android Jelly Bean (API 18), however, you will not be able to record user sessions.

Integrating the Smartlook SDK

To begin recording user sessions on your mobile apps, integrate the SDK.

  1. Implement the Smartlook analytics library in the Gradle file of your module:
implementation 'com.smartlook.android:smartlook-analytics:<<current-android-2-0-sdk-version>>'

📘

AndroidX vs. Support libraries

The Smartlook SDK version <<current-android-2-0-sdk-version>> uses the AndroidX library. If you want to include the Support library, declare the following:

implementation 'com.smartlook.android:smartlook-analytics:<<current-android-2-0-sdk-version>>-support'
  1. Declare the repository in the project-level Gradle settings file:
dependencyResolutionManagement {
  repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
      maven {
        url "https://sdk.smartlook.com/android/release"
      }
   }
}

📘

Gradle 6.8+

For older versions of Gradle, you need to declare the Smartlook Maven repository in the project-level Gradle file:

allprojects {
  repositories {
    maven {
      url "https://sdk.smartlook.com/android/release"
    }
  }
}
  1. Enter your unique projectKey and the start() call for Smartlook to record user sessions. If you do not know your project key, you can find it in the mobile project settings on the Smartlook Dashboard.

To start recording when the user opens the app, use the Application class and onCreate():

class MyCustomApplication : Application() {
  override fun onCreate() {
    super.onCreate()
        
    val smartlook = Smartlook.instance  
    smartlook.preferences.projectKey = "YOUR PROJECT KEY"
    smartlook.start()
  }
}
public class MyCustomApplication extends Application {
  @Override
  public void onCreate() {
    super.onCreate();
      
    Smartlook smartlook = Smartlook.getInstance();
    smartlook.getPreferences().setProjectKey("YOUR PROJECT KEY");
    smartlook.start();
  }
}

📘

region property

The region property identifies the location of the data center where metadata for your organization is stored. However, this does not ensure that all user data is stored in this region. When implementing the SDK, be sure to input the REGION parameter value as shown in the Smartlook project settings. For more information on where to find your region, see Organization settings.

Smartlook can store metadata in the EU and North America. If you want to change your data storage location, contact Smartlook Sales or Support.

Smartlook now records all user sessions on your app. All new user sessions will appear in the Smartlook player.

Recording when on a mobile network

The Smartlook SDK only uploads sessions when the device is connected to wifi. If you would like to upload your data when the device is on mobile data, you can enable Upload on mobile (cellular) data in project settings. For more information, see When will session recordings appear on my dashboard?.

Recording on mobile network

SDK update & migrations

The Migration guide describes the migration from version 1.x.x to version 2.x.x.