Userpilot Android SDK enables you to capture user insights and deliver personalized in-app experiences in real time. With just a one-time setup, you can immediately begin leveraging Userpilot’s analytics and engagement features to understand user behaviors and guide their journeys in-app. This document provides a step-by-step walkthrough of the installation Userpilot device mode support to your applications via this plugin for Analytics-Kotlin

Installation

The library is distributed through Maven Central. Add the Userpilot module to your build.gradle as a dependency as shown in the code sample below, and replace the <latest_version> with the latest release version.
Check Userpilot Android SDK for more details.
repositories {
    mavenCentral()
}

dependencies {
    implementation 'com.userpilot:segment-userpilot:<latest_version>'
}

Initialization

Just under your Analytics-Kotlin library setup, call analytics.add(plugin = ...) to add an instance of the plugin to the Analytics timeline.
 analytics = Analytics("<YOUR_WRITE_KEY>", applicationContext) {
        this.flushAt = 3
        this.trackApplicationLifecycleEvents = true
    }
    analytics.add(plugin = UserpilotDestination(applicationContext))
Your events will now begin to flow to Userpilot in device mode.

Userpilot SDK callbacks

To gain full control and take advantage of all Userpilot SDK features, you can use the UserpilotConfig lambda to configure the SDK according to your app’s needs. For example, if you’d like to handle Userpilot deep links, you can implement the UserpilotNavigationHandler interface to manage navigation events triggered by the SDK.
userpilotDestination = UserpilotDestination(applicationContext) {
            // optionally apply customizations using the UserpilotConfig here
            loggingEnabled = true
            navigationHandler = object : UserpilotNavigationHandler {
                override fun navigateTo(uri: Uri) {
                
                }
            }
        }
analytics.add(plugin = userpilotDestination)