View .md

MuxForms on Kotlin/Android POSTs application/json to the submit endpoint with the ingest secret in Authorization. Use coroutines on Dispatchers.IO for the network call from Compose or XML layouts.

Docs

Kotlin

Android apps use OkHttp (or Ktor client) to POST JSON—mirror the field names from your MuxForms form schema.

Kotlin

LibraryRole
OkHttpPOST body
kotlinx.serializationJSON encode
BuildConfigAvoid secret in APK—use backend
422Show field errors in UI

MuxFormsClient.kt (OkHttp)

import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import org.json.JSONObject

private val JSON = "application/json; charset=utf-8".toMediaType()

suspend fun submitContact(email: String, message: String, secret: String) {
  val body = JSONObject()
    .put("email", email)
    .put("message", message)
    .put("platform", "android")
    .put("_hp", "")
    .toString()
    .toRequestBody(JSON)

  val request = Request.Builder()
    .url("https://www.muxforms.com/api/v1/forms/FORM_UUID/submit")
    .post(body)
    .addHeader("Authorization", "Bearer $secret")
    .build()

  OkHttpClient().newCall(request).execute().use { response ->
    if (!response.isSuccessful) error("Submit failed: ${response.code}")
  }
}

Common questions

Jetpack Compose?
launch coroutine on button click; update UI state on result.
ProGuard?
Keep data classes used for JSON if minifying.
Wear OS?
Same API; shorter forms recommended.
Multi-module?
Put submit client in :network module.

Compose UI, HTTP ingest.

Pair with website embed for cross-platform support.

Upgrade to Pro