# Android SDK
URL: https://www.quiltt.dev/connector/sdk/android
Description: Integrate Quiltt Connector into your Android application with our Android Kotlin SDK. Learn how to install the package and get started with quick examples.
Navigation: connector → sdk → android
Tags: Connector, SDKs
Content Length: 5k characters

The [Quiltt Android SDK](https://github.com/quiltt/quiltt-sdks/tree/main/packages/android) provides Components for seamless integration of the Quiltt Connector into your Android app.

Info - Documentation:
For full documentation, additional examples and the source code, see the [Quiltt Android SDK on
  GitHub](https://github.com/quiltt/quiltt-sdks/tree/main/packages/android#readme).

## Install

### Maven Central

```kotlin
android {
    defaultConfig [minSdk = 26 // or greater]
}

dependencies [...
    implementation("io.quiltt:connector:<INSERT_LATEST_VERSION>")]
```

## Setting up OAuth

Quiltt always prioritizes OAuth-based connections, which require your user to provide consent on their institution's website or app, and then be redirected back to your app. This means that your application needs to be able to gracefully handle this redirect by returning them to the Connector flow in your app.

For production Environments, you must always pass a `https://` URL to `appLauncherUrl`. This URL must be a valid App Link that can launch your app, like `https://app.mydomain.com/connect_bank`.

Please see the [Android App Links guide](https://developer.android.com/studio/write/app-link-indexing) for more information.

For local development, you can use `http://`. We recommend using a tunneling service like Ngrok.

Plaid OAuth Note:

## Usage

### Jetpack Compose

```kotlin
package app.quiltt.app_jetpack_compose

class QuilttConnectorActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val config = QuilttConnectorConnectConfiguration(
            connectorId = "<CONNECTOR_ID>",
            institution = "<OPTIONAL_SEARCH_TERM_TO_PREFILL_INSTITUTION>",
            appLauncherUrl = "<YOUR_HTTPS_APP_LINK>",
            themeMode = "auto")
        val token = "<SESSION_TOKEN_FROM_SERVER>"
        setContent [QuilttConnectorContent(config = config, token = token)]
    }
}

@Composable
fun QuilttConnectorContent(config: QuilttConnectorConnectConfiguration, token: String? = null) {
    val context = LocalContext.current
    val quilttConnector = QuilttConnector(context)
    if (token != null) [quilttConnector.authenticate(token)]
    val connectorWebView = quilttConnector.connect(
        config = config,
        onEvent = [eventType, metadata ->
            println("Event: $eventType")
            println("Metadata: $metadata")],
        onExit = [eventType, metadata ->
            println("Event: $eventType")
            println("Metadata: $metadata")],
        onExitSuccess = { metadata ->
            println("Exit success!")
            println("Metadata: $metadata")
            Toast.makeText(context, metadata.connectionId, Toast.LENGTH_LONG).show()
            if (context is Activity) [context.finish()]
        },
        onExitAbort = { metadata ->
            println("Exit abort!")
            println("Metadata: $metadata")
            if (context is Activity) [context.finish()]
        },
        onExitError = { metadata ->
            println("Exit error!")
            println("Metadata: $metadata")
            if (context is Activity) [context.finish()]
        })
    AndroidView(factory = {connectorWebView} )
}

```

### XML Layout

```kotlin
package app.quiltt.example

class QuilttConnectorActivity : AppCompatActivity() {
    private lateinit var webView: QuilttConnectorWebView
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_quiltt_connector)

        val connectorLayout = findViewById<ConstraintLayout>(R.id.connector_layout)
        val quilttConnector = QuilttConnector(this)
        quilttConnector.authenticate("<SESSION_TOKEN>")
        val quilttConnectorConfiguration = QuilttConnectorConnectConfiguration(
            connectorId = "<CONNECTOR_ID>",
            institution = "<OPTIONAL_SEARCH_TERM_TO_PREFILL_INSTITUTION>",
            appLauncherUrl = "<YOUR_HTTPS_APP_LINK>",
            themeMode = "auto")

        webView = quilttConnector.connect(
            config = quilttConnectorConfiguration,
            onEvent = [eventType, metadata ->
                println("Event: $eventType")
                println("Metadata: $metadata")],
            onExit = [eventType, metadata ->
                println("Event: $eventType")
                println("Metadata: $metadata")],
            onExitSuccess = [metadata ->
                println("Exit success!")
                println("Metadata: $metadata")
                Toast.makeText(this, metadata.connectionId, Toast.LENGTH_LONG).show()
                finish()],
            onExitAbort = [metadata ->
                println("Exit abort!")
                println("Metadata: $metadata")
                finish()],
            onExitError = [metadata ->
                println("Exit error!")
                println("Metadata: $metadata")
                finish()])

        connectorLayout.addView(webView)
    }

    override fun onDestroy() [webView.destroy()
        super.onDestroy()]
}
```