GEMINI LABJP
NANOLITE — Nano Banana 2 Lite is here: Google's fastest and most cost-efficient Gemini Image model, made for running lightweight image generation cheaplyOMNIFLASH — Gemini Omni Flash is in public preview, a natively multimodal model that lets enterprises and developers build custom, dynamic video workflowsAGENTS — Managed Agents expand with background: true for async server-side runs and polling, remote MCP server integration, and refreshing credentials across interactionsMEMORY — The Memory Bank IngestEvents API is generally available, decoupling event ingestion from memory generation so you can stream content continuouslyTHROUGHPUT — Provisioned Throughput now lets you submit up to seven pending orders for the same model and regionDEPRECATE — Image generation models shut down on August 17, and the Grok 4.1 family on the Gemini Enterprise Agent Platform on August 20NANOLITE — Nano Banana 2 Lite is here: Google's fastest and most cost-efficient Gemini Image model, made for running lightweight image generation cheaplyOMNIFLASH — Gemini Omni Flash is in public preview, a natively multimodal model that lets enterprises and developers build custom, dynamic video workflowsAGENTS — Managed Agents expand with background: true for async server-side runs and polling, remote MCP server integration, and refreshing credentials across interactionsMEMORY — The Memory Bank IngestEvents API is generally available, decoupling event ingestion from memory generation so you can stream content continuouslyTHROUGHPUT — Provisioned Throughput now lets you submit up to seven pending orders for the same model and regionDEPRECATE — Image generation models shut down on August 17, and the Grok 4.1 family on the Gemini Enterprise Agent Platform on August 20
Articles/API / SDK
API / SDK/2026-05-15Advanced

Building an AI Chat App with Expo and Gemini API: From First Commit to App Store Approval

An implementation record of shipping an Expo + Gemini API chat app through both store reviews — measured streaming latency, the chunk-boundary JSON bug, image payload limits, cost ceilings, and the pre-release checklist I run.

expo2react-native2gemini-api277indie-dev43iOS13Android10streaming28AI app

Premium Article

The first time Gemini's response arrived one character at a time in my Expo chat view, I stopped and just watched it. Getting there had taken three days.

When I set out to integrate the Gemini API into a React Native app, I expected the process to be straightforward. It wasn't.

The streaming implementation alone took me the better part of two days to get right. The issue wasn't the Gemini API itself — the documentation is solid. The problem is that React Native's JavaScript environment behaves differently from a browser or Node.js, and the examples in the official docs are written with those environments in mind.

This article is a practical implementation record. I'll cover the parts that actually caused friction: streaming in Hermes, managing chat history without blowing up your token budget, handling image input, designing a freemium model that makes economic sense, and navigating the AI-specific requirements that App Store and Google Play reviewers will flag.

Why Expo, and What You Need to Know About Its Limits

For indie developers shipping to both iOS and Android, Expo's managed workflow is the right default choice. You avoid dealing with Xcode configuration drift, native module linking headaches, and platform-specific build systems. EAS Build handles the pipeline.

Where Expo's managed workflow gets constrained is around native APIs. For Gemini API integration, this matters in two places:

  • Camera and image library access: handled through expo-image-picker — no native code required
  • Audio input: handled through expo-av, though Live API integration requires more setup

The JavaScript engine is Hermes, which has its own quirks around async iterators and stream APIs. This is the root cause of the streaming problems I'll describe next.

I'm using Expo SDK 53 with @google/genai SDK 1.x. If you're on an older SDK version, upgrade first — streaming behavior changed significantly between SDK 51 and 52.

Setting Up the Gemini API Client

Installation:

npx create-expo-app my-ai-app --template blank-typescript
cd my-ai-app
npx expo install @google/genai expo-image-picker @react-native-async-storage/async-storage

API key management matters from day one. Hardcoding your key in source code is one GitHub push away from being scraped and abused. In React Native, there are two sensible approaches:

  1. Server-side proxy: Your app calls your own backend, which calls Gemini. The API key never leaves your server. Best for production.
  2. expo-secure-store: Encrypts the key at rest on the device. Acceptable for early testing; still exposes the key if someone reverse-engineers your app.

For development, use environment variables with the EXPO_PUBLIC_ prefix:

// lib/gemini.ts
import { GoogleGenAI } from "@google/genai";
 
const API_KEY = process.env.EXPO_PUBLIC_GEMINI_API_KEY ?? "";
 
if (!API_KEY) {
  throw new Error(
    "GEMINI_API_KEY is not set. Check your .env.local file."
  );
}
 
export const genAI = new GoogleGenAI({ apiKey: API_KEY });

.env.local:

EXPO_PUBLIC_GEMINI_API_KEY=YOUR_GEMINI_API_KEY

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Measured latency across three streaming approaches, and where perception diverges from total time
A buffering parser that survives JSON split across chunk boundaries
An eight-item pre-release checklist covering review, cost, and failure modes
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

API / SDK2026-07-03
Building AI-Powered iOS and Android Apps with the Gemini API — Image Recognition, Voice Analysis, Chat, and Monetization
Architecture patterns, cost optimization, and monetization for adding image recognition, voice analysis, and AI chat to iOS/Android apps with the Gemini API — updated with Gemma 4 routing and the mandatory API key restriction change.
API / SDK2026-05-13
Maximizing Revenue in Indie iOS Wallpaper Apps with AdMob + Gemini API
A decade of indie app development reveals how to balance AdMob revenue against Gemini API costs. Learn architecture patterns, cost control strategies, and Freemium gate implementation for AI-powered wallpaper apps.
Dev Tools2026-03-31
Gemini API × React Native Operational Notes — Indie Mobile App in Production
Operational notes from running Gemini API inside a React Native/Expo indie mobile app on iOS and Android: real device pitfalls, AdMob coexistence, Cold Start mitigation, AsyncStorage TTL design, and cost realities at 65,000 monthly requests
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →