Skip to content
Busymate AI

Guides

Install and configure the Android SDK

Install the versioned Android SDK, configure identity and microphone permission, and build the example app.

On this page

Install the official Android SDK distribution 1.0.5 (microphone adapter 1.0.2, files adapter 1.0.0) in an Activity-hosted WebView. Channel, identity, microphone protocol and release rules are shared by every platform on Native SDKs; this page covers only what differs on Android. Source and the configuration reference live in the public repository, and the release is 1.0.5.

1. Install the pinned version

  1. Clone https://github.com/serebano/busymate-ai-sdk-android.git at tag 1.0.5 into vendor/busymate-ai-sdk-android. Include its sdk/ directory as the :busymate-sdk project in your Gradle settings and add implementation(project(":busymate-sdk")). This release uses source-module installation, so do not substitute an unpublished Maven coordinate.
  2. Use Java 17, Gradle 8.9, Android Gradle Plugin 8.7.3, Kotlin 2.0.21 and compileSdk 35. The SDK supports minSdk 23.
  3. Set channel=android on the chat URL.

The versioned README has the exact Gradle commands.

2. Install the bridge before loading chat

Initialize the bridge and the microphone adapter in onCreate, before the Activity is STARTED and before loadUrl.

kotlin
// Gradle installation + lifecycle: https://busymate.ai/docs/guides/android-sdk
// Source: https://github.com/serebano/busymate-ai-sdk-android/tree/1.0.5
import android.webkit.WebView
import ai.busymate.bridge.BusymateBridge

fun installAssistant(
  webView: WebView,
  account: () -> String?,
  mint: (Map<String, Any?>, (BusymateBridge.MintResult) -> Unit) -> Unit
) {
  BusymateBridge.install(webView, BusymateBridge.Config(
    assistant = "your-assistant",
    origins = listOf("https://your-assistant.busymate.ai"),
    account = account,
    mint = mint
  ))
  // mint calls YOUR authenticated backend with request["nonce"], then done(result).
  // Backend endpoint: https://YOUR-PRODUCT-DOMAIN/api/bmai/identity
  webView.loadUrl("https://your-assistant.busymate.ai/?channel=android")
}
// Declare INTERNET + RECORD_AUDIO; construct BusymateMicrophone in onCreate BEFORE
// STARTED/loadUrl (it also installs BusymateFiles, the + button's file picker;
// without it: BusymateFiles.install(this, webView)); forward onPermissionRequest.
// Call BusymateBridge.accountChanged() on login/logout/account changes.

The options are assistant, origins, account, mint, onAction, onClose and onReplaced, which retains the replacement WebView after identity-only renderer recovery. See the configuration reference.

Enable JavaScript and use adjustResize. For a microphone-enabled view, recreate the Activity after renderer death, and never reinstall the adapter from the late onReplaced callback. Dispose WebView listeners and the view when the host is torn down.

3. Wire the microphone

Declare android.permission.INTERNET and android.permission.RECORD_AUDIO in AndroidManifest.xml. Construct BusymateMicrophone(activity, webView, origins) during ComponentActivity.onCreate, and forward WebChromeClient.onPermissionRequest on the UI thread to allowMedia(request). The transport needs WebView message-listener support and has no JavascriptInterface fallback. See microphone lifecycle and troubleshooting.

The adapter source, BusymateMicrophone.kt, is attached to the release with SHA256SUMS. The latest release carries the current file.

4. Let visitors attach files

An Android WebView opens no picker for the chat's attach (+) button unless the app answers WebChromeClient.onShowFileChooser. From 1.0.3, BusymateMicrophone installs BusymateFiles, which opens the system picker for images and PDFs (no new permission). Without the microphone adapter, call BusymateFiles.install(this, webView) in onCreate; a client set later forwards onShowFileChooser to BusymateFiles.install(activity, view).show(callback, params). Apps on 1.0.2 or older show no +. See attachments.

5. Run the demo

Follow the example-app instructions. It shows both renderer recovery paths. Test on a physical device.