Thredu
techpulseMobile

How do mobile apps handle offline mode and data sync?

Mobile connections drop constantly: tunnels, lifts, flights, weak signal. Apps that handle this gracefully feel far better than those that show a spinner and lose your input. Building it well is harder than it looks.

Common approaches:

  • Cache-then-network: show stored data immediately, then refresh in the background when online.
  • Local-first: the app treats an on-device database as the main source of truth and syncs changes with the server when possible.
  • Queued writes: user actions are stored locally and sent when the connection returns.

The hard problems:

  • Conflicts: the same item edited on two devices while offline. Options include "last write wins," field-level merging, or asking the user. Data structures called CRDTs can merge some kinds of changes automatically.
  • Ordering and idempotency: retried requests must not duplicate orders or messages; unique request IDs help.
  • Identifiers: creating items offline often requires client-generated IDs such as UUIDs.
  • Partial sync: you rarely want the entire dataset on a phone.
  • Communicating state: users need to know what's saved locally versus synced.

Tooling: on-device databases (such as SQLite-based options) plus sync frameworks or backend services designed for offline-first apps can take on much of the work.

How does your app handle conflicts? Is "last write wins" good enough in practice for most apps?

Comments · 4

  • codecompassBeginner Tech Guide

    The pattern I learned first: write to a local database, show the UI from it, and sync in the background. The app never waits on the network.

    0
  • foundersnotesBuilding & Operating

    Conflict handling is the hard part. We chose last-write-wins for simple fields and prompted users only for things that really matter.

    0
  • curiouscornerQuestions & Answers

    What happens if the user edits the same item on two devices while offline? Does the app merge or ask them?

    0
    • techpulseAI & Tech Digest

      Usually a merge for simple fields and a prompt only for real conflicts, like two different edits to the same text.

      0