Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
LIVEKIT_SANDBOX_ID="<your Sandbox ID>"
LIVEKIT_SANDBOX_ID="<your Token Server ID>"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ The app is configured to connect to the LiveKit homepage agent by default, which

To switch from the default agent to your own, you first need a LiveKit agent to speak with. For a no-code setup, use the [Agent Builder](https://docs.livekit.io/agents/start/builder/). For more customization, try our starter agent for [Python](https://github.com/livekit-examples/agent-starter-python), [Node.js](https://github.com/livekit-examples/agent-starter-node), or [create your own from scratch](https://docs.livekit.io/agents/start/voice-ai/).

Second, you need a token server. For development, the easiest option is the sandbox token server: enable it from your project's Options on the Settings page in LiveKit Cloud and copy the sandboxId.
Second, you need a token server. For development, the easiest option is the development token server. Read our [docs](https://docs.livekit.io/frontends/build/authentication/development-token-server/) on how to activate it for you project.

Then edit `TokenExt.kt`:

```kotlin
const val sandboxID = "your sandbox id"
const val tokenServerId = "your token server id"
```

## Token generation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.livekit.android.example.voiceassistant

// TODO: Add your Sandbox ID here
const val sandboxID = ""
// TODO: Add your Token Server ID here
const val tokenServerId = ""

// NOTE: If you prefer not to use the token server for testing, you can generate your
// tokens manually by visiting https://cloud.livekit.io/projects/p_/settings/keys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import io.livekit.android.example.voiceassistant.R
import io.livekit.android.example.voiceassistant.hardcodedToken
import io.livekit.android.example.voiceassistant.hardcodedUrl
import io.livekit.android.example.voiceassistant.homepageAgentEndpoint
import io.livekit.android.example.voiceassistant.sandboxID
import io.livekit.android.example.voiceassistant.tokenServerId
import io.livekit.android.example.voiceassistant.ui.theme.Blue500
import kotlinx.serialization.Serializable

Expand Down Expand Up @@ -106,7 +106,7 @@ fun ConnectScreen(
onClick = {
// Token source details from TokenExt.kt
val route = VoiceAssistantRoute(
sandboxId = sandboxID,
tokenServerId = tokenServerId,
hardcodedUrl = hardcodedUrl,
hardcodedToken = hardcodedToken,
homepageAgentEndpoint = homepageAgentEndpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ import kotlinx.serialization.Serializable

@Serializable
data class VoiceAssistantRoute(
val sandboxId: String,
val tokenServerId: String,
val hardcodedUrl: String,
val hardcodedToken: String,
val homepageAgentEndpoint: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class VoiceAssistantViewModel(application: Application, savedStateHandle: SavedS
val tokenSource: TokenSource

init {
val (sandboxId, url, token, homepageAgentEndpoint) = savedStateHandle.toRoute<VoiceAssistantRoute>()
val (tokenServerId, url, token, homepageAgentEndpoint) = savedStateHandle.toRoute<VoiceAssistantRoute>()

tokenSource = if (sandboxId.isNotEmpty()) {
TokenSource.fromSandboxTokenServer(sandboxId = sandboxId)
tokenSource = if (tokenServerId.isNotEmpty()) {
TokenSource.fromDevelopmentTokenServer(tokenServerId = tokenServerId)
} else if (url.isNotEmpty() && token.isNotEmpty()) {
TokenSource.fromLiteral(url, token)
} else {
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-toolin
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
livekit-lib = { group = "io.livekit", name = "livekit-android", version = "2.27.0" }
livekit-components = { group = "io.livekit", name = "livekit-android-compose-components", version = "2.4.1" }
livekit-lib = { group = "io.livekit", name = "livekit-android", version = "2.28.0" }
livekit-components = { group = "io.livekit", name = "livekit-android-compose-components", version = "2.4.2" }
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" }
timberkt = { module = "com.github.ajalt:timberkt", version.ref = "timberkt" }
Expand Down
6 changes: 3 additions & 3 deletions taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ tasks:
vars:
TOKEN_FILE: "app/src/main/java/io/livekit/android/example/voiceassistant/TokenExt.kt"
cmds:
- echo -e "Setting up sandbox..."
- echo -e "Setting up token server..."
- platforms: [darwin]
cmd: sed -i "" "s/sandboxID = \"\"/sandboxID = \"{{.LIVEKIT_SANDBOX_ID}}\"/g" "{{.ROOT_DIR}}/{{.TOKEN_FILE}}"
cmd: sed -i "" "s/tokenServerId = \"\"/tokenServerId = \"{{.LIVEKIT_SANDBOX_ID}}\"/g" "{{.ROOT_DIR}}/{{.TOKEN_FILE}}"
- platforms: [linux, windows]
cmd: sed -i "s/sandboxID = \"\"/sandboxID = \"{{.LIVEKIT_SANDBOX_ID}}\"/g" "{{.ROOT_DIR}}/{{.TOKEN_FILE}}"
cmd: sed -i "s/tokenServerId = \"\"/tokenServerId = \"{{.LIVEKIT_SANDBOX_ID}}\"/g" "{{.ROOT_DIR}}/{{.TOKEN_FILE}}"
- echo -e "\nYour Android agent example project is ready to go!\n"
- echo -e "To give it a try, open the project in Android Studio and run the app."
- echo -e "\nFor more help view your project's README.md file or join our Slack community at https://livekit.io/join-slack."
Loading