Skip to main content
This page is a reference for Android audio configuration in apps using the Humain Kiosk voice SDK. Read this if you need to customise audio routing beyond what the Android guide covers, or if you are integrating the SDK into an app that already manages AudioManager or audio focus.

AudioManager mode

The AudioManager mode controls how audio hardware behaves. For voice sessions, use MODE_IN_COMMUNICATION:

Speaker vs earpiece

Control whether audio plays through the loudspeaker or the earpiece:
isSpeakerphoneOn only takes effect when audioManager.mode == MODE_IN_COMMUNICATION. Setting it in MODE_NORMAL has no effect.

ProximityWakeLock — auto earpiece on approach

Enable auto-switching to earpiece when the user holds the device to their ear. This requires the WAKE_LOCK permission:
Use ProximityAudioRouter.start() when the voice session starts and stop() when it ends.

AudioFocusRequest

Request audio focus before starting the voice session. This ensures your app is notified when another source (phone call, navigation, alarm) needs audio:
Handle focus changes in the callback:

Bluetooth SCO

Enable the Bluetooth SCO profile to route audio through a paired Bluetooth headset (HFP — Hands-Free Profile):
Required manifest entry:
Bluetooth SCO (startBluetoothSco) is asynchronous — the connection may take 200–2000 ms. Do not start the voice session until the SCO_AUDIO_STATE_CONNECTED broadcast is received. If SCO is unavailable, fall back to speakerphone.

Full configuration sequence

The recommended order for starting a voice session: