Establish access before debugging answers
Install the debug build. Create a learner-owned key in Google AI Studio. In PocketChat open Settings → Gemini connection, enter the key, keep gemini-2.5-flash, and tap Use for this session. No Firebase configuration is involved. The app stores the key in memory; leaving it clears the key, so copy it before completing setup.
“Configured” means the field was accepted locally. Only a successful request proves provider access. Model access and quota are project-dependent; an API key alone does not establish either. Consult the current key guidance when setup fails.
Read the actual payload
val body = buildJsonObject {
putJsonArray("contents") { parts.forEach { part -> add(buildJsonObject { put("role", part.role); putJsonArray("parts") { add(buildJsonObject { put("text", part.text) }) } }) } }
putJsonObject("systemInstruction") { putJsonArray("parts") { add(buildJsonObject { put("text", AndroidEngineersGuide.systemInstruction) }) } }
putJsonObject("generationConfig") { put("maxOutputTokens", 4096); put("candidateCount", 1); putJsonObject("thinkingConfig") { put("thinkingBudget", 0) } }
}
contents carries the selected conversation; systemInstruction supplies the curated guide; generationConfig sets the output ceiling and requests one candidate. The pinned adapter uses thinkingBudget: 0, so replacing the model requires checking support for that field. Do not assume all Gemini models accept identical options.
The adapter sends the key in x-goog-api-key, not a URL query parameter. This avoids putting it into URLs, but does not turn a client-side key into production authentication. The transport is in src/debug; the release source set returns an unavailable result until a backend exists.
Map errors to actions
| Outcome | Expected interpretation |
|---|---|
| 400/401/403 | Inspect the key, request configuration, and project access |
| 404 | Check the exact configured model ID |
| 429 | Inspect quota; do not blindly retry in a tight loop |
| Network interruption | Retain partial output and offer explicit retry |
| Empty or blocked result | Show a failure explanation, not an empty successful bubble |
The app intentionally avoids echoing raw provider error bodies. A log containing credentials or private prompts would create a second data problem while debugging the first.
Check your understanding
Send “Explain the difference between a coroutine and a thread in three sentences.” A useful answer demonstrates one request on this account, not correctness for every future question. Record model, app revision, and observed behavior. Do not publish the key. The API reference documents request and response fields; the app adds its own error and lifecycle policy.