> For the complete documentation index, see [llms.txt](https://hinkal-team.gitbook.io/hinkal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hinkal-team.gitbook.io/hinkal/hinkal-mobile-sdk/android/quickstart.md).

# Quickstart

Integrate private token transfers into your Android app in a few minutes.

{% hint style="info" %}
This quickstart gets you running fast with minimal explanation. For a detailed walkthrough see Android Getting Started; for the full method list see Android API Reference.
{% endhint %}

### Installation

The SDK is published to Maven Central. Add to your `build.gradle.kts`:

```kotlin
dependencies {
    implementation("io.hinkal:hinkal-android:0.1.0")
}
```

```kotlin
import io.hinkal.mobile.Mobile
```

### Quick Example

#### 1. Implement the host wallet

```kotlin
class WalletHost(private val wallet: YourWalletImplementation) : HostWallet {
    override fun address(): String = wallet.address
    override fun chainID(): Long = wallet.chainId
    override fun personalSign(message: String): String = wallet.personalSign(message)
    override fun sendTransaction(toHex: String, dataHex: String, valueDec: String, gasLimit: Long): String =
        wallet.sendTransaction(toHex, dataHex, valueDec, gasLimit)
    override fun switchChain(chainID: Long) = wallet.switchChain(chainID)
}
```

#### 2. Connect and use the SDK

```kotlin
import io.hinkal.mobile.Mobile

// 1. Create the client and connect - derives the shielded identity.
val client = Mobile.newClient()
val address = client.connect(WalletHost(yourWallet))
val hinkal = client.hinkal()

// 2. Deposit (public → private)
val wei = Mobile.amountToWei(chainId, tokenAddress, "1.0")
val deposit = hinkal.deposit(chainId, "[\"$tokenAddress\"]", "[\"$wei\"]", true, false)

// 3. Transfer (private → private)
val transferWei = Mobile.amountToWei(chainId, tokenAddress, "0.5")
val transfer = hinkal.transfer(chainId, "[\"$tokenAddress\"]", "[\"$transferWei\"]",
                               recipientPrivateAddress, tokenAddress, "")

// 4. Withdraw (private → public)
val withdrawWei = Mobile.amountToWei(chainId, tokenAddress, "0.25")
val withdraw = hinkal.withdraw(chainId, "[\"$tokenAddress\"]", "[\"$withdrawWei\"]",
                               recipientPublicAddress, false, tokenAddress, "")
```

### Jetpack Compose Example

```kotlin
class WalletViewModel : ViewModel() {
    private val _isConnected = MutableStateFlow(false)
    val isConnected: StateFlow<Boolean> = _isConnected

    private val _address = MutableStateFlow<String?>(null)
    val address: StateFlow<String?> = _address

    private var client: Client? = null
    private var hinkal: Hinkal? = null

    fun connect(wallet: YourWalletImplementation) = viewModelScope.launch {
        client = Mobile.newClient()
        _address.value = client?.connect(WalletHost(wallet))
        hinkal = client?.hinkal()
        _isConnected.value = _address.value != null
    }

    fun deposit(chainId: Long, tokenAddress: String) = viewModelScope.launch {
        val wei = Mobile.amountToWei(chainId, tokenAddress, "1.0")
        hinkal?.deposit(chainId, "[\"$tokenAddress\"]", "[\"$wei\"]", true, false)
    }

    fun disconnect() {
        client?.disconnect()
        _isConnected.value = false
        _address.value = null
    }
}

@Composable
fun WalletScreen(viewModel: WalletViewModel) {
    val isConnected by viewModel.isConnected.collectAsState()
    val address by viewModel.address.collectAsState()

    if (isConnected) {
        Text(address ?: "")
        Button(onClick = { viewModel.deposit(chainId, tokenAddress) }) { Text("Deposit 1 Token") }
        Button(onClick = { viewModel.disconnect() }) { Text("Disconnect") }
    } else {
        Button(onClick = { viewModel.connect(yourWallet) }) { Text("Connect Wallet") }
    }
}
```
