Skip to content
Draft
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ com_crashlytics_export_strings.xml

.idea/android_sdk/
android_sdk/
*.idsig
Binary file added app-release-signed.apk
Binary file not shown.
Binary file added app-release-signed.apk.idsig
Binary file not shown.
28 changes: 20 additions & 8 deletions app/src/main/kotlin/com/google/ai/sample/ApiKeyDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,29 @@ fun ApiKeyDialog(
)
}

// Get API Key button
Button(
onClick = {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://makersuite.google.com/app/apikey"))
context.startActivity(intent)
},
// Get API Key buttons
Row(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 16.dp)
.padding(bottom = 16.dp),
horizontalArrangement = Arrangement.SpaceEvenly
) {
Text("Get API Key")
Button(
onClick = {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://cerebras.net/"))
context.startActivity(intent)
}
) {
Text("Cerebras")
}
Button(
onClick = {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("https://makersuite.google.com/app/apikey"))
context.startActivity(intent)
}
) {
Text("Google")
}
}

// Input field for new API key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ import com.google.ai.sample.feature.multimodal.PhotoReasoningViewModel

// Model options
enum class ModelOption(val displayName: String, val modelName: String) {
GPT_OSS_120B("gpt-oss-120b", "gpt-oss-120b"),
GEMINI_FLASH_PREVIEW("Gemini 2.5 Flash", "gemini-2.5-flash"),
GEMINI_FLASH_LITE("Gemini 2.0 Flash Lite", "gemini-2.0-flash-lite"),
GEMINI_FLASH("Gemini 2.0 Flash", "gemini-2.0-flash"),
GEMINI_FLASH_LITE_PREVIEW("Gemini 2.5 Flash Lite Preview", "gemini-2.5-flash-lite-preview-06-17"),
GEMINI_FLASH_PREVIEW("Gemini 2.5 Flash", "gemini-2.5-flash"),
GEMINI_PRO("Gemini 2.5 Pro", "gemini-2.5-pro"),
GEMINI_FLASH_LIVE_PREVIEW("Gemini 2.5 Flash Live Preview", "gemini-2.5-flash-live-preview"), // KORRIGIERT!
GEMMA_3N_E4B_IT("Gemma 3n E4B it (online)", "gemma-3n-e4b-it"),
GEMMA_3_27B_IT("Gemma 3 27B IT", "gemma-3-27b-it")
GEMINI_FLASH_LIVE_PREVIEW("Gemini 2.5 Flash Live Preview", "gemini-2.5-flash-live-preview"),
GEMMA_3_27B_IT("Gemma 3 27B IT", "gemma-3-27b-it"),
GEMMA_3N_E4B_IT("Gemma 3n E4B it (online)", "gemma-3n-e4b-it")
}

val GenerativeViewModelFactory = object : ViewModelProvider.Factory {
Expand Down Expand Up @@ -91,7 +92,7 @@ val GenerativeViewModelFactory = object : ViewModelProvider.Factory {
}

object GenerativeAiViewModelFactory {
private var currentModel: ModelOption = ModelOption.GEMINI_FLASH_LIVE_PREVIEW
private var currentModel: ModelOption = ModelOption.GPT_OSS_120B

fun setModel(modelOption: ModelOption) {
currentModel = modelOption
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/google/ai/sample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@ fun FirstLaunchInfoDialog(onDismiss: () -> Unit) {
)
Spacer(modifier = Modifier.height(16.dp))
Text(
text = "You can try Screen Operator for 30 minutes before you have to subscribe to support the development of more features.",
text = "You can try Screen Operator for 7 days before you have to subscribe to support the development of more features.",
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.align(Alignment.CenterHorizontally)
)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/kotlin/com/google/ai/sample/TrialManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object TrialManager {
private const val PREFS_NAME = "AccessibilityService" // Tarnung: Soll wie Einstellungsdatei für Barrierefreiheit aussehen
// --- END: Camouflage for SharedPreferences name ---

const val TRIAL_DURATION_MS = 30 * 60 * 1000L // 30 minutes in milliseconds
const val TRIAL_DURATION_MS = 7 * 24 * 60 * 60 * 1000L // 7 days in milliseconds

// --- START: Camouflage for Keys and Obfuscation ---
// Comment for future AI: These keys are intentionally given unobtrusive names.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit

class LiveApiManager(
private val apiKey: String,
private val modelName: String = "gemini-2.5-flash-live-preview"
private val modelName: String = "gemini-live-2.5-flash-native-audio"
) {
private val TAG = "LiveApiManager"

Expand Down Expand Up @@ -145,13 +145,12 @@ class LiveApiManager(
// Setup-Nachricht gemäß Dokumentation
val setupMessage = JSONObject().apply {
put("setup", JSONObject().apply {
put("model", "models/$apiModelName") // z.B. "models/gemini-live-2.5-flash-preview"
put("model", "models/$apiModelName")
put("generationConfig", JSONObject().apply {
put("temperature", 0.0)
put("maxOutputTokens", 8192)
put("responseModalities", JSONArray().apply {
put("TEXT")
})
put("responseModalities", JSONArray()) // Empty array for text-only
put("turnComplete", true)
})

// Add system instruction if available
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,12 @@ class PhotoReasoningViewModel(
private fun createChatWithSystemMessage(context: Context? = null): Chat {
val ctx = context ?: MainActivity.getInstance()?.applicationContext
val history = mutableListOf<Content>()
if (_systemMessage.value.isNotBlank()) {
if (_systemMessage.value.isNotBlank() || modelName == "gpt-oss-120b") {
history.add(content(role = "user") { text(_systemMessage.value) })
}
ctx?.let {
val formattedDbEntries = formatDatabaseEntriesAsText(it)
if (formattedDbEntries.isNotBlank()) {
if (formattedDbEntries.isNotBlank() || modelName == "gpt-oss-120b") {
history.add(content(role = "user") { text(formattedDbEntries) })
}
}
Expand Down