Guides
In-app AI support for iOS and Android
Show your assistant's chat inside your iOS or Android app, pass sign-in through your own API, and verify on a real device.
On this page
Show AI Assistant chat inside your app using the official, versioned native SDK. Each platform has its own public repository, installation instructions, configuration reference and buildable example-app/. Your authenticated backend supplies identity; the microphone adapter asks the OS when the customer taps dictation or voice.
1. Choose your platform
- Follow the iOS SDK guide for Swift Package Manager, UIKit and SwiftUI.
- Follow the Android SDK guide for the Gradle library, Activity lifecycle and WebView callbacks.
- Pin iOS SDK 1.0.1 or Android SDK 1.0.0. Their identity protocol is v2 (frozen bridge build 2.0.0); its microphone protocol is v1. These version numbers describe different components.
2. Bridge on iOS
Install the package and use the SDK callbacks. The generated integration below takes your account and backend callbacks; the platform guide explains retention, media permission and cleanup.
// Swift Package: https://github.com/serebano/busymate-ai-sdk-ios.git (exact 1.0.1)
// Full lifecycle + demo: https://busymate.ai/docs/guides/ios-sdk
import WebKit
import BusymateAI
@MainActor
func installAssistant(
on webView: WKWebView,
account: @escaping () -> String?,
mint: @escaping @MainActor (BusymateBridge.MintRequest) async throws -> BusymateBridge.MintToken?
) {
BusymateBridge.install(on: webView, config: .init(
assistant: "your-assistant",
origins: ["https://your-assistant.busymate.ai"],
account: account,
mint: mint
))
// mint calls YOUR authenticated backend with request.nonce; never cache tokens.
// Backend endpoint: https://YOUR-PRODUCT-DOMAIN/api/bmai/identity
webView.load(URLRequest(url: URL(string: "https://your-assistant.busymate.ai/?channel=ios")!))
}
// Microphone: declare NSMicrophoneUsageDescription; install and retain
// BusymateMicrophone before load, and forward WKUIDelegate media permission.
// Call BusymateBridge.accountChanged() on login/logout/account changes.3. Bridge on Android
Install the Gradle module and initialize both adapters during onCreate, before the Activity is STARTED and before loadUrl. The platform guide includes permissions, navigation and renderer recovery.
// Gradle installation + lifecycle: https://busymate.ai/docs/guides/android-sdk
// Source: https://github.com/serebano/busymate-ai-sdk-android/tree/1.0.0
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")
}
// Microphone: declare INTERNET + RECORD_AUDIO; construct and retain
// BusymateMicrophone in Activity.onCreate BEFORE STARTED/loadUrl; forward
// WebChromeClient.onPermissionRequest. See the guide for renderer recovery.
// Call BusymateBridge.accountChanged() on login/logout/account changes.4. Connect your account
Your backend signs a fresh ES256 launch token for the request's nonce, with a unique jti and expiry within 120 seconds. Keep signing keys on the server. Return no identity when signed out; do not cache a token. Call BusymateBridge.accountChanged() after login, logout and account switches. Configure onClose to dismiss your chat sheet; leave it absent when host dismissal is disabled. See backend signing.
Load the chat URL supplied for your assistant, preserving channel=ios or channel=android and supported query parameters. Allow only the exact HTTPS origins that serve that chat, including the frame origin if your page embeds it. A channel parameter alone does not identify a customer.
5. Enable microphone access
Declare the OS permission and install the microphone adapter once before loading chat. The first mic or voice tap sends busymate.microphone.v1.request with a correlated id and source of dictation or voice. The adapter asks the OS and replies with the same id and granted boolean. Chat waits before audio capture or voice token minting.
Denial, cancellation and timeout stop activation. After changing OS permission in Settings, the customer explicitly retries. The adapter does not request permission on page load, grant camera access or open Settings automatically. See each platform's microphone guide for media callbacks and teardown.
6. Configure the experience
Use your workspace settings for branding, knowledge, tools, voice availability and human handoff. Use the supported hosted chat parameters for locale and appearance; these are not invented native SDK flags. Keep the chat host out of a proxy or VPN tunnel that would loop traffic.
The chat handles its composer keyboard inset. Avoid extra native keyboard padding; Android should use adjustResize. Test safe areas, navigation and audio routing in your host app.
7. Run the example apps
Each repository's example-app/ provides settings for the chat URL, assistant, exact origins, account and backend endpoint, microphone enablement and action callbacks. It includes guest/account controls and an event log. Authenticated cases require your real backend; provider availability and workspace features depend on your configuration.
Verify
- Build the example app, open chat signed out and send a guest message.
- Connect your backend, sign in and switch accounts; verify customer history does not cross accounts.
- Tap dictation and voice separately. Test first grant, denial, Settings retry and cancellation while permission is pending on a physical device.
- Test external navigation, close, background/resume and renderer recovery.
- Enable handoff in your workspace, request a human and check the Inbox.
Questions
Which SDK should a new app install?
Use iOS SDK 1.0.1 or Android SDK 1.0.0 and the matching platform guide. Existing v1 integrations remain compatibility paths, not the installation instructions for a new app.
Where does the identity token come from?
Your authenticated backend signs it for the current request. The app contains no signing key.
Can I use guest chat first?
Yes, when your workspace permits guest access. Add authenticated identity when your backend is ready.
Do hosted updates replace app releases?
Hosted chat improvements arrive from the service. SDK changes, OS declarations and new native capabilities require your own app release.