Skip to content

Commit 8b29724

Browse files
Gemini Live sample
1 parent af47289 commit 8b29724

File tree

17 files changed

+809
-2
lines changed

17 files changed

+809
-2
lines changed

ai-catalog/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Browse the samples inside the `/samples` folder:
2121
- **imagen**: an image generation sample using Imagen
2222
- **magic-selfie**: an sample using ML Kit subject segmentation and Imagen for image generation
2323
- **gemini-video-summarization**: a video summarization sample using Gemini 2.0 Flash
24+
- **gemini-live-todo**: a todo list app using Gemini Live
2425
- More to come...
2526

2627
> **Requires Firebase setup** the samples relying on Google Cloud models (Gemini Pro, Gemini Flash, etc...)

ai-catalog/app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ dependencies {
8888
implementation(project(":samples:imagen"))
8989
implementation(project(":samples:magic-selfie"))
9090
implementation(project(":samples:gemini-video-summarization"))
91+
implementation(project(":samples:gemini-live-todo"))
9192

9293
testImplementation(libs.junit)
9394
androidTestImplementation(libs.androidx.junit)

ai-catalog/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools">
44

5+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
6+
57
<application
68
android:allowBackup="true"
79
android:fullBackupContent="@xml/backup_rules"

ai-catalog/app/src/main/java/com/android/ai/catalog/ui/domain/SampleCatalog.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import androidx.compose.runtime.Composable
2020
import androidx.compose.ui.graphics.Color
2121
import com.android.ai.catalog.R
2222
import com.android.ai.samples.geminichatbot.GeminiChatbotScreen
23+
import com.android.ai.samples.geminilivetodo.ui.TodoScreen
2324
import com.android.ai.samples.geminimultimodal.ui.GeminiMultimodalScreen
2425
import com.android.ai.samples.geminivideosummary.VideoSummarizationScreen
2526
import com.android.ai.samples.genai_image_description.GenAIImageDescriptionScreen
@@ -28,7 +29,8 @@ import com.android.ai.samples.genai_writing_assistance.GenAIWritingAssistanceScr
2829
import com.android.ai.samples.imagen.ui.ImagenScreen
2930
import com.android.ai.samples.magicselfie.ui.MagicSelfieScreen
3031

31-
val sampleCatalog = listOf<SampleCatalogItem>(
32+
@androidx.annotation.RequiresPermission(android.Manifest.permission.RECORD_AUDIO)
33+
val sampleCatalog = listOf(
3234
SampleCatalogItem(
3335
title = R.string.gemini_multimodal_sample_title,
3436
description = R.string.gemini_multimodal_sample_description,
@@ -90,6 +92,14 @@ val sampleCatalog = listOf<SampleCatalogItem>(
9092
tags = listOf(SampleTags.GEMINI_2_0_FLASH, SampleTags.FIREBASE, SampleTags.MEDIA3),
9193
needsFirebase = true,
9294
),
95+
SampleCatalogItem(
96+
title = R.string.gemini_live_todo_title,
97+
description = R.string.gemini_live_todo_description,
98+
route = "GeminiLiveTodoScreen",
99+
sampleEntryScreen = { TodoScreen() },
100+
tags = listOf(SampleTags.GEMINI_2_0_FLASH, SampleTags.FIREBASE),
101+
needsFirebase = true,
102+
),
93103

94104
// To create a new sample entry, add a new SampleCatalogItem here.
95105
)

ai-catalog/app/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
<string name="magic_selfie_sample_description">Change the background of your selfies with Imagen and the ML Kit Segmentation API</string>
1919
<string name="gemini_video_summarization_sample_title">Video Summarization with Gemini and Firebase</string>
2020
<string name="gemini_video_summarization_sample_description">"Generate a summary of a video (from a cloud URL or Youtube) with Gemini API powered by Firebase"</string>
21+
<string name="gemini_live_todo_title">Gemini Live Todo</string>
22+
<string name="gemini_live_todo_description">"Simple Todo app using the Gemini Live API to interact with the items in the list"</string>
2123
<string name="firebase_required">Firebase Required</string>
2224
<string name="firebase_required_description">This feature requires Firebase to be initialized.</string>
2325
<string name="close">Close</string>

ai-catalog/gradle/libs.versions.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ uiToolingPreviewAndroid = "1.8.1"
2929
spotless = "7.0.4"
3030
uiToolingPreview = "1.8.3"
3131
uiTooling = "1.8.3"
32+
material = "1.10.0"
33+
firebaseAi = "16.2.0"
34+
lifecycleViewmodelAndroid = "2.8.7"
35+
material3 = "1.3.2"
3236

3337
[libraries]
3438
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
@@ -54,6 +58,7 @@ androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-toolin
5458
androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
5559
androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
5660
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
61+
androidx-material3-android = { group = "androidx.compose.material3", name = "material3-android", version.ref = "material3Android" }
5762
androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
5863
androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "navigationCompose" }
5964
androidx-navigation-runtime-ktx = { group = "androidx.navigation", name = "navigation-runtime-ktx", version.ref = "navigationRuntimeKtx" }
@@ -64,12 +69,14 @@ hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref
6469
hilt-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt"}
6570
hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltNavigationCompose" }
6671
androidx-runtime-livedata = { group = "androidx.compose.runtime", name = "runtime-livedata", version.ref = "runtimeLivedata" }
67-
androidx-material3-android = { group = "androidx.compose.material3", name = "material3-android", version.ref = "material3Android" }
6872
androidx-media3-exoplayer = { module = "androidx.media3:media3-exoplayer", version.ref = "media3" }
6973
androidx-media3-ui = { module = "androidx.media3:media3-ui", version.ref = "media3" }
7074
androidx-ui-tooling-preview-android = { group = "androidx.compose.ui", name = "ui-tooling-preview-android", version.ref = "uiToolingPreviewAndroid" }
7175
ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview", version.ref = "uiToolingPreview" }
7276
ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling", version.ref = "uiTooling" }
77+
google-firebase-ai = { group = "com.google.firebase", name = "firebase-ai", version.ref = "firebaseAi" }
78+
androidx-lifecycle-viewmodel-android = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-android", version.ref = "lifecycleViewmodelAndroid" }
79+
material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
7380

7481
[plugins]
7582
android-application = { id = "com.android.application", version.ref = "agp" }
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright 2025 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
plugins {
17+
alias(libs.plugins.android.library)
18+
alias(libs.plugins.jetbrains.kotlin.android)
19+
alias(libs.plugins.ksp)
20+
alias(libs.plugins.compose.compiler)
21+
}
22+
23+
android {
24+
namespace = "com.android.ai.samples.geminilivetodo"
25+
compileSdk = 35
26+
27+
defaultConfig {
28+
minSdk = 24
29+
30+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
31+
consumerProguardFiles("consumer-rules.pro")
32+
}
33+
34+
buildTypes {
35+
release {
36+
isMinifyEnabled = false
37+
proguardFiles(
38+
getDefaultProguardFile("proguard-android-optimize.txt"),
39+
"proguard-rules.pro",
40+
)
41+
}
42+
}
43+
compileOptions {
44+
sourceCompatibility = JavaVersion.VERSION_17
45+
targetCompatibility = JavaVersion.VERSION_17
46+
}
47+
kotlinOptions {
48+
jvmTarget = "17"
49+
}
50+
}
51+
52+
dependencies {
53+
54+
implementation(libs.androidx.core.ktx)
55+
implementation(libs.androidx.appcompat)
56+
implementation(platform(libs.androidx.compose.bom))
57+
implementation(libs.androidx.material.icons.extended)
58+
implementation(platform(libs.firebase.bom))
59+
implementation(libs.google.firebase.ai)
60+
implementation(libs.androidx.lifecycle.viewmodel.android)
61+
implementation(libs.material3)
62+
implementation(libs.hilt.android)
63+
ksp(libs.hilt.compiler)
64+
implementation(libs.hilt.navigation.compose)
65+
implementation(libs.androidx.activity.compose)
66+
implementation(libs.androidx.material3.android)
67+
implementation(libs.kotlinx.serialization.json)
68+
testImplementation(libs.junit)
69+
androidTestImplementation(libs.androidx.junit)
70+
androidTestImplementation(libs.androidx.espresso.core)
71+
}

ai-catalog/samples/gemini-live-todo/consumer-rules.pro

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

0 commit comments

Comments
 (0)