---
title: "Integrate Nuxie with Android"
description: "Add the Android SDK and show the Experience you published."
search:
  tags: ["sdk", "android", "setup"]
  keywords: ["Kotlin", "Gradle", "build types", "BuildConfig", "Jetpack Compose"]
---

Use this guide with the setup prompt copied from **Connect your app**. It contains the keys for your builds and, after publishing, the Experience name and exact trigger event. You'll install the SDK, call that trigger from the relevant app action, and see the published Experience on a device or emulator.

Requires Android API 23 or later and JDK 17. Experience presentation requires a compatible Vulkan renderer on arm64-v8a or x86_64. API 23 supports setup, events, purchases, and feature access, but does not render Experiences; use a newer Android version with a compatible driver for this presentation test. If you haven't published an Experience yet, follow [Integrate your app](/docs/get-started/quickstart) first.

1. **Install the SDK**

    ## 1. Install the SDK [toc]

    Add Google and Maven Central to your app's `settings.gradle.kts`:

    ```kotlin title="settings.gradle.kts"
    dependencyResolutionManagement {
        repositories {
            google()
            mavenCentral()
        }
    }
    ```

    Add the released SDK to the app module's `build.gradle.kts`:

    ```kotlin title="app/build.gradle.kts"
    dependencies {
        implementation("ai.nuxie:nuxie-android:1.0.0")
    }
    ```

    Gradle resolves the SDK and its dependencies from Maven Central. The [Android SDK repository](https://github.com/nuxieai/nuxie-android/tree/v1.0.0) includes the example app and source-build instructions.

2. **Put each key in the matching build type**

    ## 2. Put each key in the matching build type [toc]

    Give each build type its own key, for example as a `BuildConfig` field:

    ```kotlin title="app/build.gradle.kts"
    android {
        buildFeatures {
            buildConfig = true
        }
        buildTypes {
            debug {
                buildConfigField("String", "NUXIE_API_KEY", "\"<API_KEY_DEBUG_BUILDS>\"")
            }
            release {
                buildConfigField("String", "NUXIE_API_KEY", "\"<API_KEY_RELEASE_BUILDS>\"")
            }
        }
    }
    ```

    If your app already has its own configuration system, add the key there instead. The **Debug builds** key starts with `pk_test_` and receives preview versions. The **Release builds** key starts with `pk_live_` and receives production versions. Use these publishable app keys, never workspace API keys.

    Purchases made by Google Play license testers, including from an internal testing track, are test purchases, which Nuxie accepts only with the `pk_test_` key. Build the uploads your testers buy in with the test key, for example from a separate build type, and keep the live key for the build you release on Google Play.

3. **Configure Nuxie at app launch**

    ## 3. Configure Nuxie at app launch [toc]

    Call setup once in your `Application` class:

    ```kotlin title="CadenceApplication.kt"
    import ai.nuxie.sdk.Nuxie
    import ai.nuxie.sdk.NuxieConfiguration
    import android.app.Application

    class CadenceApplication : Application() {
        override fun onCreate() {
            super.onCreate()
            val configuration = NuxieConfiguration(BuildConfig.NUXIE_API_KEY)
            Nuxie.setup(applicationContext, configuration)
        }
    }
    ```

    Register the class with `android:name` on the `<application>` element of `AndroidManifest.xml`. Setup throws when the configuration is invalid; handle that with your app's launch error handling.

    Leave `configuration.environment` at its default for every build. The key alone selects test or live content, and purchases are matched to customers by that key.

    <span id="purchase-actions-only" />

    ### Configure purchases

    Google Play Billing needs no extra configuration: Nuxie completes the purchases its Experiences start. If your app already uses a purchase provider, set `purchaseHandlingMode = PurchaseHandlingMode.APP_MANAGED` and a `purchaseDelegate` on the configuration before setup. See [Purchases](/docs/reference/android#purchases) and the RevenueCat and Superwall adapters linked there.

4. **Wire the published trigger**

    ## 4. Wire the published trigger [toc]

    ```kotlin
    Nuxie.trigger("<TRIGGER_EVENT>")
    ```

    Replace the placeholder with the exact event in the handoff. Call it from the intended user action after setup, such as an upgrade button's click handler.

    <span id="first-launch-onboarding" />

    ### Show onboarding at first launch

    To show an onboarding and paywall only to people who don't have access yet, check the Feature at launch and send the trigger only when it isn't allowed:

    ```kotlin
    lifecycleScope.launch {
        try {
            val access = Nuxie.hasFeature("<FEATURE_KEY>")
            if (!access.allowed) Nuxie.trigger("<TRIGGER_EVENT>")
        } catch (error: Exception) {
            // Access is unknown, for example offline: try again at the next launch.
        }
    }
    ```

    Run it once per launch, after setup and after `identify()` when your app restores a signed-in account, so Nuxie checks the right customer. Set the Experience's **Re-entry** to **One time** so it appears only the first time. Someone who already has access, such as after buying on another device, never sees it.

5. **Verify on a device or emulator**

    ## 5. Verify on a device or emulator [toc]

    Run the app and open **Connect your app** in Nuxie. The status changes to **Connected** when the SDK connects. Perform the app action that sends the trigger; the published screen should appear and the status should show **Shown**. Complete or dismiss the Experience to finish the run.

    On an emulator, use an arm64-v8a or x86_64 system image with Vulkan. To try the paywall without Google Play, set `testStoreEnabled = BuildConfig.DEBUG` on the configuration: Nuxie's Test Store completes the purchase without a charge and unlocks the Feature. To prove a real Google Play purchase, use a license tester; see [Testing](/docs/integrations/google-play#testing).

    If the screen does not appear, check the app key, event name, audience, and re-entry rules.

<span id="completion-report" />

## Confirm the integration

If you're using a coding agent, ask it to summarize where it added configuration and the trigger, which purchase integration it used, and what it verified on the device. This makes it easy to review the changes before releasing your app.

<span id="next-steps" />

Continue with the [Android SDK reference](/docs/reference/android) for identity, feature access, and App Actions, or [Google Play](/docs/integrations/google-play) for purchase verification.
