A security guard at a housing society gate in India deals with a visitor every few minutes: guests, delivery riders, cabs, house help. The gate is often at the edge of the plot, under a concrete canopy, on a low-cost Android phone with patchy mobile data. If the app stops logging when the network drops, the guard goes back to the paper register, and the society loses its record of who came in.
So when we built the guard app for GateKeeperZero , "keeps working offline" was a hard requirement, not a feature. Here is how it works.
The rule: write locally first, sync later
Every gate action (a visitor check-in, a delivery, a house-help entry) goes through one function: submit directly when online, queue when offline or when the request fails for a temporary reason . The guard sees the same "done" either way. The difference is only where the record waits.
The queue is a small Zustand store, persisted to MMKV so it survives the app being killed.…