androidengineers.Book a session

Configure and send a real request

Practice: Building the first request

exerciseSelf-paced

Assignment: diagnose the first request

Run the debug app with your own project. Record only the source revision, model ID, device/API level, setup state, and outcome. Do not capture the key field or raw request headers.

  1. With no key, send a question and confirm the draft remains.
  2. Configure the key, stay in PocketChat, and send a harmless technical question.
  3. Ask a follow-up referring to the earlier answer. Note whether the reference is resolved.
  4. Background the app, return, and explain why setup is required again.

Use controlled tests for failures you cannot safely or reliably reproduce against the provider:

./gradlew :app:testDebugUnitTest --tests '*GeminiChatServiceTest.quotaErrorHasActionableMessageWithoutEchoingProviderBody'

The test injects HTTP 429 through MockWebServer; it does not consume or exhaust real quota. Review the asserted error text and the deliberately sensitive fake provider body. The latter must never be displayed.

Submit a small matrix for unconfigured, successful, background-cleared, and simulated quota states. If your key has no model access, complete the deterministic test, record the provider blocker, and do not relabel simulated answers as live success.

Study guide · Hands-on codelab · Pinned Android source

YOUR LEARNING JOURNEY

0 of 23 available lessons completed

Progress saved in this browser. No account needed.
Practice: Building the first request | Gemini Chat for Android with PocketChat | Android Engineers