> ## Documentation Index
> Fetch the complete documentation index at: https://docs.truv.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Android SDK

> Truv Bridge SDK for Android (Kotlin)

**Package:** `com.truv.sdk:android_sdk` | [Maven Central](https://central.sonatype.com/artifact/com.truv.sdk/android_sdk) | [Demo app](https://github.com/truvhq/demo-android)

## Install

Add the Truv SDK to your module's `build.gradle`:

```gradle theme={null}
dependencies {
    implementation "com.truv.sdk:android_sdk:LATEST_VERSION"
}
```

Make sure `mavenCentral()` is included in your project's repository configuration.

Add the `INTERNET` permission to your `AndroidManifest.xml`:

```xml theme={null}
<uses-permission android:name="android.permission.INTERNET" />
```

***

## Embedded Orders

Use `TruvOrderView` to embed an Order, a multi-connection verification workflow that supports multiple data sources and product types.

Add to your layout XML:

```xml theme={null}
<com.truv.webview.TruvOrderView
    android:id="@+id/orderView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
```

Or create programmatically:

```kotlin theme={null}
val orderView = TruvOrderView(context)
```

Initialize and load:

```kotlin theme={null}
import com.truv.models.TruvEventPayload
import com.truv.models.TruvOrderEvent
import com.truv.webview.TruvOrderEventsListener
import com.truv.webview.TruvOrderView

class MyFragment : Fragment() {

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        val orderView = view.findViewById<TruvOrderView>(R.id.orderView)

        orderView.addEventListener(object : TruvOrderEventsListener {

            override fun onOrderEvent(event: TruvOrderEvent) {
                when (event) {
                    is TruvOrderEvent.Load -> {
                        // Order page finished loading
                    }

                    is TruvOrderEvent.Close -> {
                        // User closed the Order
                    }

                    is TruvOrderEvent.Success -> {
                        // A task within the Order completed successfully.
                        // The Order is still open at this point — it may show
                        // a success screen or a self-certification screen
                        // depending on the configuration.
                    }

                    is TruvOrderEvent.Completed -> {
                        // The entire Order is complete (all tasks finished)
                    }
                }
            }

            override fun onBridgeEvent(event: TruvEventPayload) {
                // Fired when the user interacts with the Bridge for a
                // sub-order (task) within the Order.
                // Equivalent to TruvEventsListener.onEvent().
            }
        })

        orderView.loadOrderUrl(orderToken)
    }
}
```

***

## Bridge Widget

Use `TruvBridgeView` for single-connection flows like Direct Deposit Switch and Paycheck Linked Lending.

Add to your layout XML:

```xml theme={null}
<com.truv.webview.TruvBridgeView
    android:id="@+id/bridgeView"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
```

Or create programmatically:

```kotlin theme={null}
val bridgeView = TruvBridgeView(context)
```

Initialize and load:

```kotlin theme={null}
import com.truv.models.TruvEventPayload
import com.truv.models.TruvSuccessPayload
import com.truv.webview.TruvBridgeView
import com.truv.webview.TruvEventsListener

class MyFragment : Fragment() {

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        val bridgeView = view.findViewById<TruvBridgeView>(R.id.bridgeView)

        bridgeView.addEventListener(object : TruvEventsListener {

            override fun onLoad() {
                // Bridge finished loading
            }

            override fun onClose() {
                // User closed the Bridge
            }

            override fun onSuccess(payload: TruvSuccessPayload) {
                // Called when the Bridge closes after a successful task.
                // payload.publicToken — use this to retrieve data server-side.
                // payload.metadata.taskId — the task identifier.
            }

            override fun onEvent(event: TruvEventPayload) {
                // Lifecycle event — see Bridge Events for all types.
            }
        })

        bridgeView.loadBridgeTokenUrl(bridgeToken)
    }
}
```

See [Bridge Events](/developers/sdks/bridge-events) for all event types, payloads, and error codes.

***

## Sample app

<Card title="Android Demo (Kotlin)" icon="android" href="https://github.com/truvhq/demo-android">
  Kotlin demo using the Truv Android SDK
</Card>

<Steps>
  <Step title="Clone the repo">
    Clone the demo app from GitHub and install dependencies.
  </Step>

  <Step title="Add your API keys">
    Copy your **Client ID** and **Access Secret** from the [Dashboard](https://dashboard.truv.com) into the app's configuration file.
  </Step>

  <Step title="Run in sandbox mode">
    Use [sandbox test credentials](/developers/testing/test-credentials) to simulate a full verification flow. Use the demo app as a reference to understand how the SDK works.
  </Step>

  <Step title="Integrate the SDK into your app">
    Follow the implementation guide above to add Truv Bridge to your own application.
  </Step>

  <Step title="Go live">
    Swap in production credentials in your app when ready.
  </Step>
</Steps>
