Dan Tech Academy

Mobile Action Pro Update: Gemini AI Integration, Firebase Services & More

Major codebase update for the Mobile Action Pro course — Gemini 2.0 Flash as AI Assistant backend, Firebase Analytics & Remote Config, redesigned AI dialog, overlay notification system, and architectural refactoring with the provider pattern.

Dan TechDan TechSoftware Engineer, Weight Lifter5 min readUpdated 06/23/2026

Overview

The Mobile Action Pro course codebase just received a significant update. This release introduces Gemini AI as the backend for the AI Assistant lifeline, adds Firebase Analytics and Remote Config, redesigns the AI dialog experience, and applies several architectural improvements that make the codebase cleaner and more testable.

Here is everything that changed.


New Features

Gemini AI Integration

The AI Assistant lifeline now uses Gemini AI Model as its backend, connected via a Ktor REST client.

The architecture follows a provider-based pattern with two implementations:

  • GeminiHintProvider — calls the Gemini API for intelligent, context-aware hints
  • LocalHintProvider — serves pre-defined hints as a fallback when the API is unavailable

The system automatically falls back to the local provider if the Gemini request fails, so the user experience remains smooth regardless of network conditions.

Each AI request tracks token usage metadata (input tokens, output tokens, total tokens) for monitoring consumption.

The AI confidence score is computed by the provider and passed through to the UI, giving users visibility into how certain the AI is about its suggestion.

Prompt engineering plays a key role here — the system sends the full question context, available options, and configurable parameters to produce accurate, educational hints rather than direct answers.

Firebase Services

Two Firebase services were added to the project:

Firebase Analytics tracks key user events throughout the quiz game flow:

  • game_started — when a quiz session begins
  • game_completed — when the player finishes all questions
  • answer_submitted — each answer attempt with correctness metadata
  • lifeline_used — when the AI Assistant or other lifelines are activated
  • sign_in / sign_out — authentication events

Firebase Remote Config drives configuration values without requiring app updates:

  • Gemini parameters: model name, temperature, max tokens, retry count, and API key
  • Game configuration: timer duration, difficulty level, question count

All game config values are consolidated into a single Remote Config JSON object, parsed into a GameConfig data class using kotlinx.serialization. This means you can tune the game experience from the Firebase console — no new build needed.

AI Assistant Dialog Redesign

The AI Assistant dialog received a visual and functional overhaul:

  • Loading states with animations while the AI request is in-flight
  • Error handling with user-friendly messages when the request fails
  • Button disabled during loading to prevent double-tap issues
  • Timer paused while awaiting the AI response, so students are not penalized for network latency

UI Overlay System

A new OverlayQueueManager handles game notifications and alerts. Instead of stacking multiple dialogs or toasts, notifications are queued and displayed sequentially, providing a cleaner user experience during gameplay.

Cross-platform Secret Encoding

The secret encoding scripts now support Windows in addition to macOS and Linux. This ensures all team members can encode and decode secrets regardless of their development environment.


Improvements & Refactoring

Provider Pattern

The monolithic AI hint service was extracted into a clean AIHintProvider interface with GeminiHintProvider and LocalHintProvider implementations. This separation makes each provider independently testable and easy to swap.

Dependency Injection Cleanup

String-based Koin qualifiers were replaced with an AIHintProviderType enum, making the DI configuration type-safe and less error-prone.

Dispatcher Injection

The Gemini provider now accepts coroutine dispatchers via constructor injection instead of hardcoding Dispatchers.IO. This is critical for unit testing — tests can inject UnconfinedTestDispatcher for deterministic execution.

API Key Migration

The Gemini API key was moved from NDK native secrets (compiled into the binary) to Firebase Remote Config. This makes the key:

  • Rotatable — change it from the Firebase console without a new app release
  • More secure — not embedded in the APK where it could be extracted

Config Consolidation

Scattered Remote Config keys were merged into single JSON objects:

  • GeminiConfig — all Gemini-related parameters in one place
  • GameConfig — all game-related settings in one place

This reduces the number of Remote Config fetches and keeps related settings together.

RemoteConfigManager Upgrade

The RemoteConfigManager was upgraded to use suspend functions instead of callback-based APIs, with proper dependency injection and a shared kotlinx.serialization.Json instance for consistent parsing across the app.


Bug Fixes

  • AI Assistant button: Disabled during loading to prevent double-tap; timer pauses while awaiting AI response
  • JNI secrets: Re-encoded with a new XOR key after pipeline changes to fix decoding failures

What This Means for Students

These changes make the Mobile Action Pro codebase a better learning resource:

  1. Real-world architecture — The provider pattern, DI with enums, and dispatcher injection are patterns you will use in production Android apps
  2. Firebase integration — Learn how to use Analytics and Remote Config in a real project, not just a tutorial
  3. AI integration — See how to integrate a large language model into a mobile app with proper error handling and fallback strategies
  4. Testability — Every refactoring decision was made with testability in mind

If you are enrolled in the course, pull the latest codebase and explore the changes. If you have not started yet, now is a great time — the codebase is cleaner and more educational than ever.

Course

Ready to Build Real Mobile Apps?

The Mobile Action Pro course teaches you a production-ready cross-platform mobile app workflow with Kotlin foundations, Clean Architecture, AI-assisted delivery, and real-world projects.

  • 9 modules, 108 hands-on lessons
  • Kotlin foundations, MVVM, DI
  • AI-powered quiz game project
  • Lifetime access & community support
Explore Mobile Action Pro

Happy coding!

Reading is fun. A roadmap gets you there.

The Kotlin Android Roadmap sorts the Android Mastery, OOP and Design Patterns posts into 5 levels - from your first line of Kotlin to an app on the store.

Plus a new post every week. Unsubscribe anytime.