Understand models and API capabilities before writing the client.
1. Model versus service
Gemini is a model family exposed through APIs. A model name selects behavior and supported features; the client library transports requests. Do not assume all models accept the same modalities or tool combinations.
2. Request and response parts
A request may contain instructions, text and media parts. The response can contain candidates, structured data or tool requests. Treat absent candidates and blocked responses as explicit outcomes.
3. Mobile access boundary
A privileged provider key in an APK can be extracted. Choose a backend adapter or a supported Firebase AI Logic setup with application protection. User authentication and abuse controls still need deliberate design.
Worked scenario
An internal JVM prototype can read a key from its environment. Copying that configuration into an Android build is not a production credential strategy.
Apply it
Draw the Android-to-inference request path. Mark each credential, trusted component and response boundary.
Check your understanding
You can explain where model credentials live and how a user request is authorized. Explain the decision and show evidence from your implementation or design. If you cannot demonstrate it yet, revisit the relevant section before continuing.