Kotlin

Android. An .aar carrying the four ABIs and Kotlin bindings generated with UniFFI, so the surface mirrors Swift name for name.

Builds from the repository; there is no Maven artifact yet. The handle is Tenant, as in Swift; everything else is spelt as on the other heads.

Build the package

From a checkout of the tacenta repository, with the Android NDK installed:

bindings/android/build-aar.sh

Then declare the .aar as a dependency of your module.

Send a message

// Every call that touches the network is a suspend fun.
val tenant = Tenant.connect(apiKey)
tenant.signUp("alice", password)
val client = tenant.signIn("alice", password)

client.find("bob")?.let { bob ->
    client.send(bob.address, "hello".toByteArray())
}

client.inbound().asFlow().collect { message ->
    println(String(message.plaintext))
}

No host or port: the handle fetches the server's service document and finds the services from it. A self-hosted server is Tenant.connect(apiKey, "chat.example.org"). inbound().asFlow() is a Flow of the messages as they arrive, and receive() the same as batches; both suspend, so collect from a coroutine. The Android README in the repository shows how an emulator reaches a development server on the host, and tacenta init kotlin writes this sample with your key in place.

Keep the identity across runs

exportState and tenant.signInWithState carry the identity and sessions across runs. The sealed variants, with a Keystore-backed SecureStore attached, resist rollback; the Android README in the repository shows one.

Reference

The generated reference, Dokka of the bindings, regenerated at every release from the code it documents: tacenta.com/dl/reference/kotlin/.