# Installation


This guide explains how to install and configure the User.com Mobile SDK in your Android application. Follow these instructions after completing the prerequisite configuration steps from the Mobile SDK Setup guide.

INFO

SDK supports platform versions from Android 5 (API 21) to Android 15 (API 35). Checkout more on Distribution dashboard. (opens new window)

# SDK Installation

# Add Repository Source

First, add the User.com Android SDK repository to your project's settings.gradle.kts file:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        // Your existing repositories
        maven {
            url = uri("https://android-sdk.user.com")
        }
    }
}

# Add Dependency

Next, add the SDK dependency to your app-level build.gradle.kts file:

dependencies {
    // Your existing dependencies
    implementation("com.user:android-sdk:1.2.8")
}

# SDK Configuration

In your Application class, initialize Mobile SDK with the configuration values you obtained during the prerequisites setup.

Initialization in an Application class is recommended, as this guarantees availability of the SDK instance throughout whole lifecycle of your Mobile App.

# Initialize the SDK

Make sure your application class is correctly added to the Manifest file. After that, you can initialize SDK with a builder.

  • Kotlin
  • Java
class ExampleApp : Application() {

    override fun onCreate() {
        super.onCreate()
        
        UserCom.Builder(
            this,
            "mobile_sdk_key", // Your 64-character Mobile SDK Key from User.com
            "integrations_api_key", // Your App Key from Settings → Setup & Integrations
            "https://<your_app_name>.user.com" // Your App Domain from Settings → Setup & Integrations
        )
            .trackAllActivities(true)
            .openLinksInChromeCustomTabs(true)
            .setCustomTabsBuilder(getCustomTabsBuilder())
            .build()
    }
    
    // Optional: Customize Chrome Custom Tabs appearance
    private fun getCustomTabsBuilder(): CustomTabsIntent.Builder {
        val builder = CustomTabsIntent.Builder()
        builder.setToolbarColor(Color.GREEN)
        return builder
    }
}

Calling build() method will initialize UserCom instance.

The SDK can be customized with several configuration options:

Method Default Description
trackAllActivities() false Automatically track user screen views across your app
openLinksInChromeCustomTabs() true Use Chrome Custom Tabs to open web links
setCustomTabsBuilder() - Customize the appearance of Chrome Custom Tabs
setDefaultCustomer() - Provides option to create UserCom instance with a Customer data instead of creating an anonymous User
setOnSdkInitializedListener() - Provides option to attach listener for when UserCom instance is created

INFO

Read more about built in methods in Android API Reference.

# Next Steps

After successfully installing the SDK, you can proceed to:

# Resources

Explore our sample implementations to better understand how to integrate the SDK:

For more detailed technical information and help with issues, visit our: