Android SDK
Live voice with a VoiceMint agent from a Kotlin Android app.
Kotlin, minSdk 24. Streams the microphone to an agent and plays its voice, with the platform echo canceller, barge-in and transcripts. Source: github.com/alphaaiservice/voicemint-android (MIT).
Install#
Not on Maven Central yet. Build it into your local Maven repository:
git clone https://github.com/alphaaiservice/voicemint-android
cd voicemint-android && ./gradlew :voicemint-android:publishToMavenLocal// settings.gradle.kts: repositories { mavenLocal(); google(); mavenCentral() }
dependencies {
implementation("com.alphaaiservice.voicemint:voicemint-android:0.1.0")
}INTERNET, RECORD_AUDIO and MODIFY_AUDIO_SETTINGS are merged from the library's manifest; ask for the microphone at runtime before starting.
Talk#
val minted = myApi.voicemintToken(agentId) // {ws_url, token} from YOUR backend
val session = VoiceMintSession.fromLiveSession(this, token = minted.token, wsUrl = minted.wsUrl)
lifecycleScope.launch { session.events.collect { e -> if (e is VoiceMintEvent.Transcript) show(e.role, e.text) } }
session.start()
hangUpButton.setOnClickListener { session.stop() }Also: mute(Boolean), sendText(String), events for state (connecting, listening, speaking, ended, error), agent audio level, errors and the end reason. Version 1 is foreground only.