-
-
History: past re-routes are saved, like Camden Town to Warren Street via Northern and Victoria.
-
Welcome screen: PocketRoute finds another way when your Tube trip breaks, with the map and voice input stored on the iPhone.
-
Onboarding 2 of 3: say or tap what happened. Understood on-device by Apple Intelligence, or by Gemini when online.
-
Onboarding 1 of 3: save the full London Tube map (272 stations, 2.4 MB) to the phone so re-routing works with no signal.
-
Station search: type part of a name to pick your station from the saved map, even offline.
-
Set-up complete: Tube map, voice input and nearest-station settings are ready, so re-routing works without a signal.
-
Onboarding 3 of 3: optional location to remember the last station you passed. It stays on the iPhone, only while the app is open.
-
Re-route form filled in: Camden Town to Warren Street on the Northern line, with "Train held" selected.
-
Re-route home: choose where you are, where you're going and the line you were on, then tap what happened.
-
Follow-up: you say the Charing Cross branch isn't running, and the assistant checks that against the saved map.
-
Settings: map city and auto-updates, step-free changes only, Apple Intelligence on device and optional Gemini when online.
-
A new trip from Euston on the Victoria line: two ways to Warren Street, ride one stop or walk 600 m.
-
Three ways from Camden Town to Warren Street, ranked by journey time, with the fastest option highlighted.
-
The update is matched by keywords and the assistant re-routes, avoiding the Northern line between Camden Town and Warren Street.
-
New routes after the closure: Northern to Victoria via Euston is now fastest, with walking and Piccadilly alternatives.
-
City picker: London Underground is available now, with Paris Métro and New York Subway coming soon.
-
Ambiguous stations: understood on the iPhone, the assistant asks which Edgware Road you mean and shows each one's lines.
-
Honest limits: asked if the Central line is running, the assistant explains it can't see live service offline.
Inspiration
This project was inspired by the many scenarios when I rode the London underground tubes to work, and the train had to suddenly terminate, and I needed a new way to route myself to another station in order to complete my journey. Other navigation apps such as Google and Apple Maps don't work when offline, and even when the journey is already set, you cannot find another route without the internet.
Many deep Tube stations and tunnels in London and around the world have no usable signal. In this situation, people can struggle to read and understand the map on the wall or ask a stranger for help navigating. I want to solve this problem using Firebase on-device AI inference!
What it does
PocketRoute keeps a copy of the Tube map on your phone. When your plans change, you tell the app what happened, and it gives you other routes to your destination without requiring an internet connection.
Here is an example:
You type "Held at Camden on the Northern, need Warren St". The app shows what it understood: you are at Camden Town, you want Warren Street, you are on the Northern line, and your train is held. The app shows three routes. You can stay on the Northern line (9 min), change to the Victoria line at Euston (14 min), or walk (26 min). Then you can tell the app more. For example, you type "The Charing Cross branch isn't running". The app removes that route and shows the others.
The app also does these things:
If a name matches two stations, the app asks which one you mean. For example, London has two Edgware Road stations. The app does not guess. If you ask "Are there delays on the Central line?", the app tells you that it cannot see live service offline. It does not make up an answer. You can ask for step-free routes, fewer changes, or a walk. The step-by-step guidance has a "Something's wrong" button. This button finds a new route from the step that you are on. PocketRoute is an iPhone app (iOS 26 or later). It is also a web app that you can install on your phone or computer.
How we built it
I used one main rule. The AI reads your words. The saved map and the route engine give all the facts. Each message goes through five steps:
- Read. An AI model changes your words into fields: stations, line, what happened, what is closed, and what you prefer.
- Ground. Our code removes each station or line name that is not in your message. In this app, "ground" means "keep only what you said".
- Match. Our code finds each name on the saved map. For example, "kx" becomes King's Cross St. Pancras.
- Route. The route engine finds paths on the saved map. It gives the same answer each time for the same input.
- Reply. Our code writes the reply from the map data. The AI does not write the reply.
The app is hybrid. It uses an AI model on the device first. It uses Gemini in the cloud when the device model cannot run. Firebase AI Logic connects both. On iPhone, Apple's on-device model (Apple Intelligence) reads the message first. If it cannot run and you are online, Gemini reads the message through Firebase AI Logic.
On the web, Firebase AI Logic runs Chrome's built-in Gemini Nano model on your computer. If that model is not available, Firebase AI Logic sends the message to Gemini in the cloud. If no model can run, keyword rules read the message. Keyword rules are fixed word patterns in our code. All models use the same JSON schema. A JSON schema is a fixed list of fields and types. As a result, the rest of the app gets the same type of answer from each model.
Under each message, the app shows who understood it. The labels are "Understood on this iPhone", "Understood in this browser", "Understood by Gemini", and "Matched by keywords".
I also used these Firebase products:
- App Check protects the Gemini calls from misuse.
- Remote Config can turn off Gemini or change the Gemini model without a new app release.
- Firebase Hosting serves the web app and the Tube map data.
- The Tube map data for London comes from TfL Open Data. I wrote a tool that changes this data into a network of stations, lines, branches, interchanges, and walking links.
Challenges we ran into
Small AI models try too hard to help. Apple's on-device model changed station names and added closures that the passenger did not report. For example, a passenger typed "trains not running between Camden and Euston". The model also marked Euston as closed. As a result, the app showed only the walk option.
We changed the design. The model only reads words, and it does not decide facts. Then we added rules that remove closures the passenger did not say.
The Firebase AI Logic SDK for iOS changed during the hackathon. Version 13 added a new way to use Gemini through Apple's Foundation Models framework. We moved to it, and the Gemini score fell to 11 out of 30. The new setup made each field required, so Gemini put "held" on every message. We gave Gemini its own output type, with a "none" choice for each field. Its score went back to 29 out of 30.
Accomplishments that we're proud of
We built two offline-first apps in 20 days for native iOS and PWA. The whole London tube network JSON data (2.24 MB) was also parsed and cleaned to work on mobile at 172 KB. The saved map has these parts:
- 272 stations on 11 lines.
- 79 service patterns, so the app knows each branch, for example the Charing Cross and Bank branches of the Northern line.
- 2,149 track segments and 83 interchanges.
- 295 lifts and 92 step-free interchanges from TfL data, for step-free routes.
The AI has a time limit. Each model gets 6 seconds on iPhone and 8 seconds on the web. If the model is slow or cannot run, keyword rules read the message. As a result, the passenger always gets an answer, and a tap on a quick reply gets an answer at once. We wrote 30 test messages and scored each field. If a reader added a station the passenger did not mention, the message failed.
What we learned
A small on-device model is good at reading what people mean. It is not good with facts. We give it the reading job only.
Measure the model output before blindly trusting it. Over 500 test messages revealed several edge cases where the model gave an unexpected output, and we were able to fix it.
Hybrid AI is easier when each path gives the same type of answer. Then the app does not care which model answered.
What's next for PocketRouter
When the phone has a signal before the trip, get planned closures from the TfL API. The passenger confirms each closure, and the route search avoids it.
An Android app, with Gemini Nano on the device.
Built With
- ai
- firebase
- ios
- javascript
- mobile
- navigation
- web

