Offline-first apps: how they keep working without a connection

Updated · 5 min read

Where offline use matters most

Offline-first design pays off where coverage is unreliable. Typical examples are field inspections, deliveries, construction sites, clinic visits outside urban areas, large events with crowded networks, and travel through mountain roads or underground car parks. In these settings, an app that waits for the server loses work or frustrates the person doing it.

How the app stores data on the device

The screens read from a local database on the phone, not directly from the server, so they open instantly. SQLite is the common choice across platforms. Apple platforms often use Core Data or SwiftData, and Android apps often use Room, which sits on top of SQLite. Background work copies server data into this store and sends the local changes back.

  • Read from local storage so screens never wait on the network.
  • Save every change locally and add it to an outbox, which is a queue of pending writes.
  • Pull the latest server data and merge it into the local store on each sync.

What happens when the connection returns

When the device is online again, the app sends the outbox in order. Each write should carry an ID that the device created, so a retry after a dropped connection does not create a duplicate order or record. The server should recognise an ID it has already processed and reply with success rather than adding it twice.

Background sync is controlled by the operating system, which may delay it to save battery. Do not rely on it running at an exact moment. Also sync when the app opens and when the user asks for it, so the user is never waiting on a timer.

Conflicts: when two people change the same record

A conflict happens when two devices edit the same record while offline. You must decide the rule before launch, and the right rule depends on the data. Timestamps taken from device clocks are unreliable, so prefer a version number that the server issues with each record.

  • Last write wins: simple to build, but one person's changes can silently disappear.
  • Field-level merge: combine changes made to different fields of the same record.
  • Server decides: a defined business rule chooses the winner, and the rule is written down.
  • Ask the user: show both versions and let the person choose, for records where a mistake is costly.

What users need to see about sync

Users trust an offline app when it is honest about its state. Show whether each item is saved on the device, syncing, synced or needing attention. Never hide a failed sync, because a person who believes the work is saved and later finds it missing will not forgive the app.

Store sensitive data carefully. Keep access tokens in the iOS Keychain or Android Keystore rather than in plain files, encrypt the local store where the platform supports it, and clear local data at sign-out on any shared device.

Mistakes that cause data loss

Most offline failures come from a few habits. Developers create IDs on the server after the device has already saved a record, delete local copies before the server confirms receipt, or let two sync processes run at once. Each one is easy to test for, and each is expensive to fix after release.

  • Delete local data only after the server confirms it has been saved.
  • Test what happens when airplane mode switches on in the middle of a save.
  • Check the server for duplicates after a deliberate kill and restart during a sync.

How Hundred Seas helps

Hundred Seas is a product studio in Taipei that builds native iOS and Android apps. When an app has to work in weak coverage, we agree the offline behaviour, the sync rules and the conflict cases during scoping, before the build starts, because those choices shape the whole data model.

We start with a scope step of about one week at a fixed price, finishing with a written plan, a clickable prototype and a firm quote. Working software then arrives in weekly releases, and a monthly run plan keeps it current after launch.

Questions

Which features should work offline?
Start with tasks in the field that cannot wait for a signal, such as reading a checklist, recording a measurement or capturing a photo. Leave out anything that needs live data, such as payments or stock levels, unless the app shows clearly that the information may be out of date. Decide the list with the people who do the work.
Is offline-first the same as an offline mode?
Not quite. An offline mode usually switches some features off when there is no connection. Offline-first treats the device as the main place where work happens and the server as the place where copies are reconciled. It takes more design, but people notice fewer stalls and far less lost work.
Can an offline app keep sensitive data on the phone?
Yes, but store only what the task needs, use the platform's encrypted storage, keep tokens in the Keychain or Keystore and clear the local store at sign-out on shared devices. Check your industry's rules on personal data before deciding what the app keeps.
How do I test an offline app properly?
Test on real devices. Switch airplane mode on during saves, close the app while changes are queued, and restore the connection partway through a sync. Then check the server for duplicates and missing records. Simulators do not reproduce poor coverage well, so test where your users actually work.
Does offline support add much to the cost?
It adds design and testing work, mostly in sync and conflict handling, so plan for it at the start rather than adding it later. The effort depends on how many records change, how many people edit them and how strict the data rules are. Scoping is the right place to set this out.

Have a project in mind?

Tell us what you want to build. We reply with a plan, not a sales call.

AboutOffline-first apps: how they keep working without a connection