Screen API in Kotlin SDK Alpha

Learn about the screen API call in Kotlin SDK.

This guide explains how to use the screen API in Kotlin SDK.

Overview

The Kotlin SDK provides a screen API that lets you record whenever your user views their mobile screen, along with any additional relevant information about the screen.

Method definition

The screen method definition is as follows:

The below table describes the screen method signature in detail:

FieldData typeDescription
screenNameStringName of the screen viewed by the user.
categoryStringScreen category.
propertiesPropertiesAdditional properties describing the screen to be sent along with the event.
optionsRudderOptionAdditional event options.

A sample screen event sent from the Kotlin SDK is shown below:

analytics.screen(
    screenName = "Main Screen",
    category = "Main",
    properties = buildJsonObject {
        put("type", "application")
    },
    options = RudderOption(
        customContext = buildJsonObject {
            put("key", "value")
        },
        integrations = buildJsonObject {
            put("Amplitude", true)
            put("INTERCOM", buildJsonObject {
                put("lookup", "phone")
            })
        },
        externalIds = listOf(
            ExternalId(type = "brazeExternalId", id = "value1234"),
        ),
    ),
)

Questions? Contact us by email or on Slack