Guides and Surveys Android SDK

Amplitude's Guides and Surveys Android SDK enables you to deploy Guides and Surveys in your Android applications.

This SDK is in Open Beta

This feature is in open beta and under active development.

Requirements

The Guides and Surveys Android SDK requires:

Install and initialize the SDK

Guides and Surveys supports different installation options to work best with your existing Amplitude implementation, if you have one.

Using Amplitude Android-Kotlin 1.0+

Add the following dependencies to your application's build.gradle.kts file:

dependencies {
    // Amplitude Engagement SDK
    implementation("com.amplitude:amplitude-engagement-android:1.0+")

    // Amplitude Analytics SDK (required dependency)
    implementation("com.amplitude:analytics-android:1.+")
}

Initialize the SDK

import com.amplitude.android.engagement.AmplitudeEngagement
import com.amplitude.android.engagement.AmplitudeInitOptions

// Initialize the SDK
val amplitudeEngagement = AmplitudeEngagement(
    context = applicationContext,
    apiKey = "YOUR_API_KEY",
    options = AmplitudeInitOptions()
)

// Add the plugin to your Amplitude instance
val amplitude = Amplitude(applicationContext)
amplitude.add(amplitudeEngagement.getPlugin())

Configuration options

Parameter Type Description
apiKey string Required. API key of the Amplitude project you want to use.
initOptions.serverZone EU or US Optional. Sets the Amplitude server zone. Set this to EU for Amplitude projects created in EU data center. Default: US
initOptions.logLevel LogLevel.None or LogLevel.Error or LogLevel.Warn or LogLevel.Verbose or LogLevel.Debug. Optional. Sets the log level. Default: LogLevel.Warn
initOptions.locale string Optional. Sets the locale for localization. Default: undefined. Not setting a language means the default language is used.

Use the same API key for Guides & Surveys and Analytics

To avoid analytics mismatches and ensure accurate data collection, use the same API key for both Guides & Surveys and your Analytics SDK. Both should reference the same Amplitude project. Using different API keys can cause:

  • The SDK to fetch guides and surveys from the wrong project
  • Analytics data to appear in different projects
  • Insights and survey responses are incomplete or mismatched

Make sure the API key you provide to Guides & Surveys matches the API key used to initialize your Amplitude Analytics SDK.

Note

After you call amplitude.add, you are technically done installing. While screen tracking and element targeting are optional, Amplitude recommends that you set up URL handling for preview mode.

Not using Amplitude Android-Kotlin 1.0+

In this case, installation is very similar to above; however, you need to manually call .boot.

Add the following dependencies to your application's build.gradle.kts file:

dependencies {
    // Amplitude Engagement SDK
    implementation("com.amplitude:amplitude-engagement-android:1.0+")

    // Amplitude Analytics SDK (required dependency)
    implementation("com.amplitude:analytics-android:1.+")
}

Initialize the SDK

import com.amplitude.android.engagement.AmplitudeEngagement
import com.amplitude.android.engagement.AmplitudeInitOptions

// Initialize the SDK
val amplitudeEngagement = AmplitudeEngagement(
    context = applicationContext,
    apiKey = "YOUR_API_KEY",
    options = AmplitudeInitOptions()
)

// Add the plugin to your Amplitude instance
val amplitude = Amplitude(applicationContext)
amplitude.add(amplitudeEngagement.getPlugin())

Configuration options

Parameter Type Description
apiKey string Required. API key of the Amplitude project you want to use.
initOptions.serverZone EU or US Optional. Sets the Amplitude server zone. Set this to EU for Amplitude projects created in EU data center. Default: US
initOptions.logLevel LogLevel.None or LogLevel.Error or LogLevel.Warn or LogLevel.Verbose or LogLevel.Debug. Optional. Sets the log level. Default: LogLevel.Warn
initOptions.locale string Optional. Sets the locale for localization. Default: undefined. Not setting a language means the default language is used.

Use the same API key for Guides & Surveys and Analytics

To avoid analytics mismatches and ensure accurate data collection, use the same API key for both Guides & Surveys and your Analytics SDK. Both should reference the same Amplitude project. Using different API keys can cause:

  • The SDK to fetch guides and surveys from the wrong project
  • Analytics data to appear in different projects
  • Insights and survey responses are incomplete or mismatched

Make sure the API key you provide to Guides & Surveys matches the API key used to initialize your Amplitude Analytics SDK.

Boot the SDK

// Basic boot with user ID
amplitudeEngagement.boot("USER_ID")

// Advanced boot with options

let bootOptions = AmplitudeBootOptions(
  userId: "USER_ID",
  deviceId: "DEVICE_ID",
  userProperties: mapOf("key" to "value")
  integrations = arrayOf({ event: BaseEvent ->
    // Custom event handler
    // Dummy example here:
    println("event: ${event.eventType} properties: ${event.eventProperties}")
  })
)
amplitudeEngagement.boot(options: bootOptions)

Note

After you call amplitude.boot, you are technically done installing. While screen tracking and element targeting are optional, Amplitude recommends that you set up URL handling for preview mode.

Add your application to project settings

After installing the SDK, add your Android application to your Amplitude project settings so it appears as a platform option when you create guides and surveys.

To add your application:

  1. Navigate to Settings > Projects in Amplitude.
  2. Select your project.
  3. Navigate to the General tab.
  4. In the Platform section, click + Add Platform.
  5. Select Android from the platform list.
  6. Enter your application details:
    • App name: Your app's display name
    • Package name: Your Android package identifier (for example, com.example.myapp)
  7. Click Save.

After you add your application, it appears as a platform option when you create or edit guides and surveys. This enables you to target your Android users and preview guides directly in your app.

Find your package name

Your Android package name is defined in your AndroidManifest.xml file or in your app-level build.gradle file as the applicationId.

Screen tracking and element targeting

Enable screen tracking

Required for screen-based targeting and the Time on Screen trigger. The screen string (eg "HomeScreen" in the example below) is compared with the string provided in the guide or survey page targeting section.

// Track screen views to trigger guides based on screens
amplitudeEngagement.screen("HomeScreen")

Warning

Screen Viewed events from the Amplitude Android-Kotlin SDK's Autocapture feature are auto-forwarded to the Engagement SDK.

Enable element targeting

Pin and tooltip guides require the ability for the SDK to target specific elements on screen.

Jetpack Compose

Use Amplitude Engagement's .amplitudeView modifier to tag Jetpack Compose views. Pass your instance of AmplitudeEngagement as a parameter to .amplitudeView. Configure a CompositionLocalProvider and access it in your view hierarchy or pass your instance as a parameter to your composable views.

// Jetpack Compose Tagging

@Composable
fun MyView() {
    // Use your instance of Amplitude Engagement by creating a Composition context or passing as a param
    val engagement = LocalEngagement.current

    Box {
        Button(
            modifier = Modifier.amplitudeView(
                engagement, 
                tag = "my-button",
                onTrigger = {
                    // Optional code to run with tap element action
                }
            )
        )
    }
}

Non-Jetpack Compose

Guides and Surveys also supports non-Jetpack Compose views. The SDK uses the tag, contentDescription, or resourceName fields to check for a matching selector. You need to set only one of these.

Configure this in your existing layout XMLs or programmatically by setting the properties on the view instance.

<!-- in my_layout.xml -->
<LinearLayout>
    <Button
        <!-- Set either contentDescription or tag to your desired selector -->
        android:contentDescription="my-button"
        android:tag="my-button" />
</LinearLayout>
// Non Jetpack Compose Programmatic Tagging
val button = Button(this)

// Set the contentDescription
button.contentDescription = "my-button"
// Or, set the tag
button.tag = "my-button"

Manage themes

Configure the visual theme mode if your app supports light and dark modes.

// Set the theme mode
amplitudeEngagement.setThemeMode(ThemeMode.DARK) // Options: AUTO, LIGHT, DARK

Router configuration

Configure how Guides and Surveys handles screen navigation.

engagement.setRouter { identifier ->
  // Your screen handling and navigation
}
Parameter Type Description
identifier String Required. A screen identifier (or route) that tells your app where to navigate.
router (callback) (String) -> Unit Required. A callback you implement to handle screen navigation when Guides or Surveys need to change screens.

Update link behavior

After you configure the router with setRouter(), update the link behavior setting in the Guides and Surveys interface. For any link actions in your guides or surveys, change the behavior to Use router. This ensures that the guide or survey uses the custom router function instead of the default browser navigation.

Reset

Reset a guide or survey to a specific step.

amplitudeEngagement.reset(key = "GUIDE_KEY", stepIndex = 0)
Parameter Type Description
key string Required. The guide or survey's key.
stepIndex number Required. The zero-based index of the step to reset to. Defaults to the initial step.

List

Retrieve a list of all live guides and surveys along with their status.

val guidesAndSurveys = amplitudeEngagement.list()

Show

Display a specific guide or survey. Ignores any targeting rules and limits except for screen targeting.

amplitudeEngagement.show(key = "GUIDE_KEY")
Parameter Type Description
key string Required. The guide or survey's key.

Forward event

If you don't use the plugin, but want to trigger Guides using events, call forwardEvent with any events want to use as triggers.

// Forward events from Amplitude to trigger guides
val event = BaseEvent()
amplitudeEngagement.forwardEvent(event)

Close all

Close all active guides and surveys.

amplitudeEngagement.closeAll()

Simulate Guides and Surveys for preview

To use preview mode to test a guide or survey in your app, configure a custom URL scheme.

Add your mobile app to project settings

Before you can use preview mode, add your Android app to your project settings in Amplitude:

  1. In Amplitude, navigate to Settings > Organization Settings > Projects.
  2. Select your project.
  3. Click the Guides and Surveys tab.
  4. In the App Management section, click Add App.
  5. Enter your Android app's package name (for example, com.example.myapp).
  6. Click Save.

After you add your app, Amplitude generates a unique URL scheme for mobile preview.

Locate the mobile URL scheme

After adding your app to project settings, locate the URL scheme:

  1. In the Guides and Surveys tab of your project settings, find the URL scheme (mobile) field.
  2. Copy its value, for example, amp-abc123.

Add the URL scheme in Android Studio

Add the following intent filter to the main activity to your project's AndroidManifest.xml file:

<activity android:name=".MainActivity">
    <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <!-- Add your URL scheme from Amplitude Dashboard here -->
    <!-- ex: android:scheme="amp-12345" -->
    <data android:scheme="<your-unique-scheme-id>" />
    </intent-filter>
</activity>
// In your Activity
override fun onNewIntent(intent: Intent?) {
    super.onNewIntent(intent)
    amplitudeEngagement.handlePreviewLinkIntent(intent)
}

Changelog

You can access the changelog here.

Was this page helpful?

June 23rd, 2025

Need help? Contact Support

Visit Amplitude.com

Have a look at the Amplitude Blog

Learn more at Amplitude Academy

© 2025 Amplitude, Inc. All rights reserved. Amplitude is a registered trademark of Amplitude, Inc.