Learn through PocketCards, the runnable flashcard app in Android + AI Cookbook. Open the hands-on codelab · Browse the pinned source.
Your deliverable
Extend PocketCards into a source-grounded study tool and explain the engineering choices. Completing this project means you can reason about boundaries and prove behavior, not merely display a successful model response. Start with the pinned codelab revision, preserve the existing sample and make changes on your own branch.
Part 1: reproduce and explain
Run the manual path before enabling Firebase. Trace notes through Compose, PocketCardsViewModel, CardGenerator, validation and DeckRepository. Draw where data leaves the device and where it becomes durable. Explain why the generator can be faked in tests and why that is insufficient evidence of live model quality.
Part 2: improve duplicate validation
Complete the codelab's red/green exercise: treat case and repeated whitespace as equivalent when detecting duplicate questions, while preserving the learner-facing question text. Add a regression test before changing validation. The test must fail against the pinned sample, then pass with the implementation. Explain why this catches a formatting duplicate but cannot identify every semantic paraphrase.
Part 3: add one independent feature
Choose a subject filter, a clear insufficient-source-material message, or source quotations attached to generated answers. Write acceptance criteria before implementation. A source-quotation feature must verify that the quotation occurs in the notes; displaying a model-supplied quotation alone is not grounding. A subject filter must never delete decks hidden by the filter. An insufficient-material state must retain notes and offer a useful next action.
Acceptance example: subject labels
Given two saved decks with different labels,
when I filter by one label,
then only matching decks are shown, and clearing the filter restores both.
After process restart, labels and decks remain available.
Part 4: demonstrate failure behavior
Test offline generation, short notes, cancel during generation, malformed output through a fake and storage failure through an injected repository. Finish the last card using both ratings. Reopen the app and inspect saved favorites and review dates. Unsaved drafts currently do not survive process death: document this rather than claiming full restoration.
Review rubric
| Area | Evidence required |
|---|---|
| Product reasoning | A specific user need and a deterministic alternative considered |
| AI integration | One actual provider request, model/revision recorded, reviewed answers |
| State ownership | Loading, cancellation, retry and save-failure behavior demonstrated |
| Data boundaries | Private configuration excluded; source content not logged |
| Quality | Ten evaluation cases, supported-answer and coverage counts, five failures |
| Maintainability | Focused tests, understandable contracts and runnable setup |
Submit a short README, source commit, test results, evaluation sheet and a brief app-only recording. Separate measured outcomes from estimates and untested assumptions. Do not share a configured debug APK or an App Check token with the portfolio.
Explain without notes: Why can structured output still be wrong? What happens if cancellation races with a response? Why does the last-card snapshot matter? Which action requires network access? When would this JSON-file repository stop being appropriate?
After this capstone, continue to Firebase AI Logic for a deeper provider integration or on-device AI for a different inference boundary. PocketCards is a foundation for those decisions, not a demonstration of every AI capability.
Source and further reading
- PocketCards implementation and setup
- Firebase structured output
- Android state production
- App Check for emulators
Assess your finished work
Complete the final assessment. It includes a 40-point knowledge check, a 60-point project rubric, an answer key and required completion gates. Use actual evidence to score yourself and record any unfinished criteria.