Android (Kotlin) SDK Quickstart

Install and use the RudderStack Android (Kotlin) SDK on your Android apps.

This guide will walk you through setting up the Android (Kotlin) SDK and sending your first events to RudderStack.

Github Badge

Prerequisites

Step 1: Install Android (Kotlin) SDK

The steps covered in the below sections will help you integrate the RudderStack Android (Kotlin) SDK into your Android project:

Add dependencies

Configure Maven Central

warning
Make sure that your app has the necessary permissions to send network requests.

Step 2: Initialize the SDK

Before tracking any events, initialize the Android (Kotlin) SDK in your Application class, as shown:

Replace the WRITE_KEY and DATA_PLANE_URL parameters with the Android (Kotlin) source write key and the data plane URL obtained in Prerequisites.

Step 3: Identify users

You can use the identify event to identify a user and associate them with their actions. It also enables you to record any traits about them like their name, email, etc.

You can use the identify method as follows:

Step 4: Track user actions

Once the Android (Kotlin) SDK is initialized, you can send track user actions and send them as events.

A sample track event triggered once the order is completed successfully is shown:

In the above snippet, the track method logs an event called Order Completed along with two event properties revenue and currency that provide additional context to the event.



Questions? Contact us by Email or on Slack