Skip to content

feat: add a LiveKit voice transport to the test app - #206

Merged
nozokada merged 41 commits into
adobe:feature/voicefrom
nozokada:feat/demo-app-voice
Nov 26, 2026
Merged

nozokada merged 41 commits into
adobe:feature/voicefrom
nozokada:feat/demo-app-voice

Conversation

@nozokada

@nozokada nozokada commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Base: feature/voice, cut from main at 3.10.2. Voice lands there, not in dev, so releases during the restricted change period don't pick it up. The pilot will use a prerelease build from that branch, and the branch goes to dev once a public release is approved.

Stacked on #205 (which is stacked on #197). GitHub can't base a PR on a fork branch, so this targets feature/voice and also shows those commits. Please review only these commits:

  • feat: add a LiveKit voice transport to the test app
  • docs: walk through adding voice with the LiveKit transport
  • docs: explain removing LiveKit's unused manifest permissions
  • feat: report LiveKit reconnects to Brand Concierge in the test app transport
  • fix: end the voice conversation when the test app loses audio focus for good
  • docs: explain how a phone call affects the test app's voice conversation
  • docs: explain when the test app's voice spinner appears after a network loss
  • feat: keep the test app's voice conversation running in the background with a foreground service
  • docs: add the voice foreground service to the LiveKit walkthrough
  • feat: send data messages from the demo transport
  • docs: say voice conversations send the XDM context captured at the start
  • Register the test app's voice transport at launch
  • Tidy the voice section of the implementation guide

Android counterpart of adobe/aepsdk-concierge-ios#191. The test app now carries a reference VoiceTransport built on LiveKit. The same file replaces the voice plugin in the voice reference app (Adobe-AI-Core-Services/voice_demo-app-android#2).

Description

  • LiveKitTransport.kt (test app): a complete VoiceTransport on the LiveKit Android SDK 2.29.1, meant to be copied into apps.
    • Connections are main-confined. Each connect gets its own room and coroutine scope, and a superseded room is released off the main thread.
    • Room events reach the listener only for the current room. A client-initiated disconnect, the room being deleted or the participant being removed reports Disconnected; any other disconnect reason (including ROOM_CLOSED) or error reports Failed, the same set as the iOS demo app's transport.
    • LiveKit's full reconnects are reported as Reconnecting, then Connected. LiveKit 2.29.1 sends no room event for a quick resume, so a resume shows no spinner, and sends Disconnected if it gives up.
    • A transient audio focus loss is reported as an audio interruption, and focus gain as its end, through LiveKit's AudioSwitchHandler. A permanent loss (AUDIOFOCUS_LOSS) leaves the room and reports Failed, because the audio will not come back and the chat has no unmute control.
    • Microphone changes are serialized.
    • Preconnect audio is on, so the user can speak while the room connects.
    • Implements send(data, topic, callback) (added in feat: hold voice conversations through an app-provided transport #205) with publishData and DataPublishReliability.RELIABLE, and calls the callback with the result. With no room it completes with an error, so Brand Concierge shows its send-failed message; if the conversation ends before the publish finishes, it completes with the cancellation.
    • Returns continuesInBackground true (see feat: hold voice conversations through an app-provided transport #205) and runs a microphone foreground service from connect until the connection ends, so a conversation keeps running with the screen locked or in another app.
  • VoiceForegroundService.kt (test app): the foreground service, also meant to be copied. Its ongoing notification opens the app, and its End action or removing the app from recent apps leaves the room and reports a normal end. Without the notification permission it runs without the notification; the test app doesn't ask for it. The manifest declares it with foregroundServiceType="microphone" and the FOREGROUND_SERVICE, FOREGROUND_SERVICE_MICROPHONE and POST_NOTIFICATIONS permissions.
  • Wiring: one app-wide instance (Voice.transport, created in ChatApp.onCreate) is registered with Concierge.setVoiceTransport (feat: hold voice conversations through an app-provided transport #205 section 7), so every chat entry point (MainScreen, LinkHandlingTesting, both DataHandoffDemo chats and XmlChatActivity) gets voice without passing it.
  • Dependency: io.livekit:livekit-android:2.29.1 on the test app only. JitPack was already in settings.gradle.kts, and the test app already declares RECORD_AUDIO.
  • Docs: the implementation guide walks through adding LiveKit (and JitPack), the microphone permission, removing the camera and screen-sharing permissions and service that LiveKit's manifest merges in, copying the transport, registering one app-wide instance with Concierge.setVoiceTransport at launch, background conversations with the foreground service (its manifest entries are in step 2), and audio quality: echo cancellation, speaker output, interruptions (including a permanent focus loss ending the conversation), and the device checks to repeat.

How Has This Been Tested?

  • ./gradlew :testapp:assembleDebug builds (after the latest changes, :testapp:compileDebugKotlin and make lint pass, and :testapp:installDebug runs on a Galaxy S25).

  • End to end on a Galaxy S25 (Android 17) with a temporary instrumentation test (not committed), against the Stage voice-enabled configuration: open the chat, start voice, connect and subscribe to the agent's audio track, receive data-channel messages, hold 10 s, stop cleanly.

  • A phone call during a session (Galaxy S25): the conversation continues while the phone rings (Android doesn't signal the ring to the app). Answering moves the app to the background; with the background opt-in the conversation continues, muted until the call ends (checked again while locked). The guide describes this.

  • Wi-Fi off during a session (Galaxy S25, Stage, which cellular can't reach): the spinner appears about 30 seconds after Wi-Fi goes off, and the conversation ends with an error 30 seconds later. LiveKit first waits 20 seconds for its server check to time out, then tries a quick resume for 10 seconds, which sends no event; the spinner appears with the full reconnect. iOS shows it after about 10 seconds because the Swift SDK reports quick reconnects too. The transport doc and the guide describe this.

  • Speaker and headphones (Galaxy S25): no echo on the speaker, and switching wired and Bluetooth headphones mid-session moves the audio as expected (Bluetooth, then the speaker when it disconnects, then another Bluetooth headset when it connects).

  • Background on a Galaxy S25 (Android 17) (Stage config and a 3-minute cap in a local build only): screen locked, another app in front, locking while connecting, a product card while locked, an incoming call while locked, Wi-Fi ↔ cellular, Bluetooth, removing the app from recent apps, the notification and its End action, notifications denied, the cap, and 60 s of silence in the background. With feat: hold voice conversations through an app-provided transport #205's scroll fix, the voice reply stays on screen as it arrives.

  • On a Galaxy S25 with feat: hold voice conversations through an app-provided transport #205's voice turns (Stage config in a local build only): a product card arriving while the screen is locked renders with the reply after unlocking, and a suggestion tapped during voice reaches the agent through send(data, topic, callback) and gets a voice reply. Taps while connecting, while the user speaks or before the reply starts are ignored, and after voice ends a tap streams as typed chat.

  • On a Galaxy S25 with feat: hold voice conversations through an app-provided transport #205's held XDM context (temporary test code, not committed): the bootstrap sends the held context and voice connects. After the context changes during voice, a suggestion tapped in that conversation is tracked with the bootstrap's context, and the next bootstrap and a typed send use the new one.

  • On a Galaxy S25 with feat: hold voice conversations through an app-provided transport #205's thinking indicator (Stage config in a local build only): the indicator shows after speaking and after a suggestion tap, turns into the reply when its text starts, and is removed when voice stops while it shows.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

nozokada and others added 2 commits October 27, 2026 17:34
Add LiveKitTransport, a reference VoiceTransport on the LiveKit Android
SDK that apps can copy, and pass one app-wide instance to every chat
entry point in the test app.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The voice section of the implementation guide now covers adding LiveKit
(and JitPack), the microphone permission, copying the reference transport,
keeping one app-wide instance and passing it to every chat entry point
(the same instance for chats that share a view model), and audio quality:
echo cancellation, speaker output, interruptions and the device checks to
repeat.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nozokada
nozokada force-pushed the feat/demo-app-voice branch from 76d7593 to d159abd Compare October 28, 2026 00:34
nozokada and others added 18 commits October 28, 2026 16:10
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts:
#	Documentation/implementation-guide.md
Only leaving, a deleted room or a removed participant end the conversation normally, matching the iOS reference transport.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ansport

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…or good

A permanent focus loss reports Failed instead of an audio interruption, since the audio will not come back and the chat has no unmute control.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rk loss

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d with a foreground service

LiveKitTransport opts in to background conversations and runs a
microphone foreground service from connect until the connection ends.
The service's ongoing notification opens the app, and its End action or
removing the app from the recent apps leaves the room and reports a
normal end. The service reaches the transport through a callback it
holds only while a conversation runs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Declare the service and its permissions, keep LiveKit's
FOREGROUND_SERVICE entry, copy the service with the transport, and
update the phone call and device check notes. Background conversations
now follow the audio notes so those stay with the walkthrough.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nozokada
nozokada changed the base branch from dev to feature/voice November 10, 2026 02:31
@nozokada nozokada mentioned this pull request Nov 10, 2026
1 of 3 tasks
@nozokada
nozokada marked this pull request as ready for review November 10, 2026 03:32
@nozokada
nozokada requested a review from ishwetansh November 10, 2026 03:33
nozokada and others added 15 commits November 12, 2026 13:35
State the Brand Concierge version voice needs, that voice must be enabled
for the Brand Concierge by Adobe, and the current limitations: no auth
token or XDM context, server-set language, English-only voice UI text,
WebRTC network requirements and the Google Play Data safety disclosure.
Clarify in the style guide that enableVoiceInput controls dictation only
and which colors the voice conversation button uses.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the long paragraph on what happens during a voice conversation
with a short list of what the user sees and when the conversation ends.
Leave the transport timing and interruption rules to the VoiceTransport
API documentation and the Audio quality section, and drop the duplicated
60-minute and end-condition text.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the JitPack repository into its own settings.gradle.kts snippet
ahead of the LiveKit dependency, with a callout naming the JitPack-only
artifact and the Gradle error shown when the repository is missing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
LiveKitTransport changed the microphone in a coroutine and only logged a
failure, so Brand Concierge kept the conversation going while the
microphone could be live during an interruption or muted while the chat
shows Listening. A mute or unmute that throws or returns false now leaves
the room and reports Failed, as VoiceTransport asks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts:
#	Documentation/implementation-guide.md
Implement VoiceTransport.send by publishing the message to the room
with reliable delivery on the given topic. The callback gets
publishData's result, or the cancellation if the conversation ends
first, so it always completes once.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts:
#	Documentation/implementation-guide.md
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts:
#	Documentation/implementation-guide.md
# Conflicts:
#	Documentation/implementation-guide.md
The test app registers its LiveKit transport once with
Concierge.setVoiceTransport in Application.onCreate, instead of passing
it to every ConciergeChat and ConciergeChatView. The style guide says
the voice button appears while a transport is registered.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use one heading level for the voice steps, place Background
conversations after the steps, and point to the manifest entries in
step 2 instead of repeating them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@rymorale rymorale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the test app updates LGTM with just a couple of nits to take a look at.

callback.onComplete(error)
}.invokeOnCompletion { cause ->
// A send cancelled by [disconnect] still completes, with the cancellation.
if (cause != null) callback.onComplete(cause)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this can complete the callback twice if disconnect() cancels the job just after publishData finishes. The coroutine body calls onComplete, then invokeOnCompletion sees the cancellation and calls it again. The SDK guards against duplicate completions, so this isn't blocking, but the reference transport should follow the exactly-once contract. Can we use a single completion path or guard both calls with an AtomicBoolean?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Both paths now go through one AtomicBoolean guard, so the callback completes exactly once: from the coroutine if it finishes, otherwise with the cancellation. Fixed in 0e94c3a.

*
* Copy this file and [VoiceForegroundService] into your app and add `io.livekit:livekit-android` to
* your app's dependencies. Create one instance with the application context and pass it to every
* `ConciergeChat(...)` call and `ConciergeChatView`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this setup guidance is stale now that transport registration is global. Can we say to create one app-wide instance and register it with Concierge.setVoiceTransport in Application.onCreate(), rather than pass it to each chat? That would match the implementation guide and avoid sending people copying this file toward the removed chat parameters.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated: it now says to create one instance for the life of the app and register it once with Concierge.setVoiceTransport, for example in Application.onCreate(), as the implementation guide does. Fixed in 35afe9e.

nozokada and others added 3 commits November 25, 2026 11:10
A send that disconnect() cancelled just after publishData returned
completed the callback from the coroutine and again from
invokeOnCompletion. Both paths now go through one guard.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@rymorale rymorale left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the changes LGTM overall with just an implementation guide update needed.

Comment thread Documentation/implementation-guide.md Outdated

### Limitations

- **No authentication token.** Brand Concierge doesn't send the token from `Concierge.setAuthTokenProvider` when it starts a voice conversation, so the voice agent works without it. Typed and dictated messages in the same chat still include it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we update this limitation and the matching sentence in the Authentication section (line 176)? createVoiceBootstrapRequestBody() now includes authDataPart(), so the token from Concierge.setAuthTokenProvider is sent with the voice-start request. The remaining limitation is that the voice agent doesn't receive it yet, rather than that voice startup doesn't send it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

nozokada and others added 2 commits November 25, 2026 16:28
The voice bootstrap now sends the token from setAuthTokenProvider. The
remaining limitation is that the voice agent doesn't use it yet.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@nozokada
nozokada merged commit 2b01417 into adobe:feature/voice Nov 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants