-
-
Offline: the iPhone and the model-less Android phone hand reports to Command over the mesh; the photo route shows 2 radio hops
-
Architecture: Firebase AI Logic on Chrome, iOS and Android, a signed journal on every device
-
Uplink back: the cloud Gemini second opinion disagrees with the on-device tag, so a person is asked to look
Inspiration
Five days after Hurricane Helene, nearly half the cell sites in the FCC's western North Carolina reporting area were still out of service. After Hurricane Maria, 96% of Puerto Rico's cell sites went dark at the worst point. In those first hours the people doing the work are neighbours and volunteer responders, and their phones have no signal. We wanted AI that keeps helping them when the network is gone, and a cloud that checks that work when it comes back.
What it does
BeaconGrid is offline-first disaster observation for field teams and a staging-post command laptop.
- Field phones (Android and iOS) file photo reports and notes into an append-only, signed journal. Reports spread phone to phone over a local mesh (store-and-forward), so a report reaches Command even when the phone that took it has no signal.
- Inference follows the mesh. Whichever nearby device has a model does the AI work. An Android phone with no model hands its photo to the mesh; Command in Chrome tags it on-device, and the suggestion travels back to the author, who confirms or corrects it. Every AI answer shows its route (on-device or cloud) and which device produced it.
- Command web (Chrome) shows every report on a map with its evidence: event time and receipt time, signature check, how many radio hops the photo took, and every AI answer. It writes cited briefings and pre-send checks for team chat, on-device when the model is ready.
- When the uplink returns, the journal syncs to Firestore and the cloud checks the work: a cloud Gemini second opinion sits beside the on-device answer and a disagreement is flagged for a person. Cloud Gemini also correlates reports into leads that cite their evidence and list what is still unknown.
- A named person decides. AI never changes a report's verification state and never dispatches a task; a commander approves each task under their own name, and it crosses the mesh to the field phone.
- Privacy: reports marked as being about a person stay on the mesh and never reach the cloud or cloud AI.
How we built it
- Firebase AI Logic hybrid inference on every platform:
- Chrome:
prefer_on_devicerouting runs Chrome's built-in model through the Prompt API (text and image) and falls back to cloud Gemini; the route badge comes from the response's inference source. - Android (Kotlin/Compose): Firebase AI Logic with
OnDeviceConfig(Gemini Nano status and download), route reported frominferenceSource; with no Nano on the device, photos go to the mesh or the cloud. - iOS (SwiftUI): Apple Foundation Models structure field notes on the phone (
@Generable); cloud Gemini through Firebase AI Logic uses the same session API.
- Chrome:
- App Check is enforced (reCAPTCHA Enterprise on the hosted web app, debug providers on emulators and the Simulator), with anonymous Authentication, Firestore as the cloud copy of the journal (append-only rules, envelopes checked for shape, commander-only approvals, rules tested in the emulator), Remote Config for the routing policy, and Firebase Hosting for Command.
- RescueMesh: each event is sealed with a SHA-256 hash of its canonical JSON and signed with ECDSA P-256 in the device key store (Android Keystore, Secure Enclave, a non-extractable WebCrypto key). Journals are grow-only sets, so sync is idempotent and order-free. Records relay any number of hops; a photo relays at most three, so one 4 MB photo cannot flood the mesh. The same envelope and projection logic is implemented and cross-tested in TypeScript, Kotlin and Swift.
- RadioSim stands in for the local radio on emulators and the Simulator: it decides who is in range, and lets us cut links and uplinks on camera.
Challenges we ran into
- Keeping three implementations (TypeScript, Kotlin, Swift) byte-compatible: canonical JSON, hashing and signature verification are checked against shared test vectors on every platform.
- On-device model availability varies by machine and by phone. The same code path has to answer from the device, from a neighbour on the mesh, or from the cloud, and say honestly which one it was.
- Privacy holds that also cover derived records (tasks, report-backs, SOS locations, place pins) so nothing person-related leaks to the cloud through a side door.
Accomplishments that we're proud of
- A photo taken on an offline phone with no model, tagged on-device by another device over a simulated mesh, with the suggestion returned and confirmed, and the cloud checking it afterwards.
- One signed journal format shared by Chrome, Android and iOS: each platform verifies envelopes sealed and signed by the others, and convergence and hop budgets are covered by tests.
What we learned
Hybrid inference is most useful when the device with the model is not the device with the problem. Making the route visible on every answer is what lets people trust it.
What's next for BeaconGrid
Gemini Nano on real Nano-capable Android phones, a real radio transport (Wi-Fi Aware / Bluetooth) in place of RadioSim, and trials with a CERT team.
Prototype for decision support only. Not certified for dispatch, rescue navigation, medical triage or structural assessment. All incident data in the demo is simulated.
Built With
- apple-foundation-models
- chrome-built-in-ai
- firebase-ai-logic
- firebase-app-check
- firebase-authentication
- firebase-hosting
- firebase-remote-config
- firestore
- gemini
- gemini-nano
- jetpack-compose
- kotlin
- maplibre
- node.js
- react
- swift
- swiftui
- typescript
- webcrypto