# Installation

Requirements

  • Android 5.0 (API 21) or later
  • compileSdk 35

# Step 1 - Add the SDK repository

Add the Positive User maven repository to your settings.gradle.kts:

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

# Step 2 - Add the dependency

In your app-level build.gradle.kts:

dependencies {
    implementation("com.user:android-sdk:1.2.14")
}

# Step 3 - Add your Firebase configuration

The SDK uses Firebase Cloud Messaging to deliver push notifications. Add your google-services.json to the app module directory and apply the Google Services plugin.

In your project-level build.gradle.kts:

plugins {
    id("com.google.gms.google-services") version "4.4.0" apply false
}

In your app-level build.gradle.kts:

plugins {
    id("com.google.gms.google-services")
}

WARNING

If google-services.json is missing or misconfigured, push notifications will not work.


# Step 4 - Initialize the SDK

Initialize the SDK in your Application class to keep it available for the full app lifecycle.

Declare your Application class in AndroidManifest.xml:

<application
    android:name=".ExampleApp"
    ...>

Then initialize with your credentials. Your keys are available in Positive User under Settings - App Settings - Advanced - Mobile keys and Settings - Setup & Integrations.

  • Kotlin
  • Java
class ExampleApp : Application() {

    override fun onCreate() {
        super.onCreate()

        UserCom.Builder(
            this,
            "YOUR_MOBILE_SDK_KEY",        // 64-character Mobile SDK Key
            "YOUR_INTEGRATIONS_API_KEY",  // App Key from Settings - Setup & Integrations
            "https://your-domain.user.com"
        )
            .trackAllActivities(true)
            .build()
    }
}

# Builder options

Method Default Description
trackAllActivities(boolean) false Automatically track screen views across your app
openLinksInChromeCustomTabs(boolean) true Open web links in Chrome Custom Tabs
setCustomTabsBuilder(CustomTabsIntent.Builder) - Customize Chrome Custom Tabs appearance
setDefaultCustomer(Customer) - Start with an already identified contact instead of an anonymous one
setOnSdkInitializedListener(OnSdkInitializedListener) - Callback fired when the SDK instance is ready

# What's next