AppCradle
All articles

Offline App Actions: Save Locally, Confirm After Sync

Design offline checklist edits around durable local saves, confirmed server results and explicit conflicts. Measure completed actions separately from retries and delayed uploads.

By AppCradle · Published

A checklist travels from a Google-marked notebook to a cloud where it receives a green confirmation seal.

An offline action should acknowledge exactly what the app has achieved. After a durable local write, tell the person their change is saved on this device and waiting to sync. Confirm the shared result only after the server has accepted the operation under the application's rules. Keep failures and conflicts visible without throwing away the person's work.

Consider a fictional shared packing checklist. Someone marks “pack charger” complete while disconnected. They should be able to reopen the app and see that local change. They should not be told that the rest of the group has received or read it.

Google's Android architecture guidance describes writing critical data locally before arranging network synchronization, using an offline to-do list as an example. It also distinguishes local data from remote state and highlights the need to reconcile conflicts. Android offline-first architecture

Define what each confirmation means

Agree on the customer-facing states before choosing a background worker. The following model is a proposal for the checklist, not a list of Android API states.

StateEvidence requiredSuggested explanation
Saving locallyWrite has started but not committedSaving on this device
Saved locallyEdit and pending operation are durably recordedSaved here; waiting to sync
SyncingAn attempt is runningUpdating the shared list
ConfirmedServer confirms the operation was appliedSynced with the shared list
Needs attentionConflict or rejection prevents completionReview this change
UnconfirmedResponse is absent or inconclusiveSaved here; checking sync status

“Confirmed” is a milestone for that operation. A later edit can make the item pending again, and another person's subsequent change can alter the shared result. A network connection icon proves neither server acceptance nor that another device has refreshed.

Define acknowledgement in the endpoint's contract. An HTTP response saying work was merely queued does not establish that the checklist changed. Identify the operation and the committed result, or provide a way to check its status.

Make the local promise durable

For this checklist, store the changed item and its pending operation together. Otherwise, an interruption can leave a checkmark with no work scheduled to share it, or a queued change that the screen never reflects.

On Android, Room supports executing related database work in a transaction. Its transaction documentation describes grouped operations and success handling. Use the appropriate transactional mechanism for your storage layer; this local boundary does not make the later network request atomic with it. Room transactions

Only show “saved here” after that boundary succeeds. If storage is full or the write fails, retain the editable input where possible and explain the failure. An animated checkmark or an in-memory value is not evidence of a durable save.

Give each pending operation a stable identity, its target item, intended change and relevant starting version. Keep those operational identifiers private. Preserve the originating account association so a queued edit cannot accidentally upload under whichever account signs in next. Follow an explicit retention and sign-out policy rather than promising that local data survives deletion or uninstalling the app.

Retry the same intention

For the proposed protocol, retry the original operation identifier with the same intended payload. The server should recognize an operation already applied and return its recorded result. Coordinate the duplicate check and business change so competing requests cannot both create an effect.

Prefer an explicit intention such as “set this item complete” to “toggle this item.” Replaying a toggle can undo the first successful attempt. Operation identity is still necessary when retries race later edits or the action has additional effects.

Android's WorkManager supports network constraints and retry backoff. Its documentation also explains that constraints and system optimizations affect execution time. Use those mechanisms to schedule suitable attempts, but avoid promising an immediate sync the moment connectivity returns. Work requests and retry policy

Separate retryable interruptions from cases requiring action. A temporary network failure can wait; a revoked sharing permission needs an explanation. Revalidate authorization on the server. An offline copy of the list is not continuing permission to modify it.

A manual Retry button should reuse the existing pending operation. It must not compete with the background worker by manufacturing a second business action. If the server applied the edit but its reply was lost, the next attempt should reconcile that result.

Resolve a disagreement before calling it synced

Suppose one person checks an item offline while another removes it from the shared list. Blindly uploading the old list could restore a deliberately deleted item and erase unrelated edits. Choose a policy for each conflict: merge compatible changes, retain the remote result, or ask the person to decide.

Where your HTTP API supports versioned updates, If-Match can make a change conditional on the resource still matching a known version. The HTTP specification describes this mechanism for preventing lost updates. It detects a mismatch; it does not choose the product's resolution policy. HTTP conditional updates

For the checklist, a useful resolution screen might explain that the item was removed and let the person discard their pending completion or deliberately create a new item. Preserve enough context to make that choice understandable. Do not silently recreate the item because the offline operation arrived last.

Test ordering within one device too. If someone checks and then unchecks an item offline, replay or compact those operations according to an explicit rule that preserves the intended final state. A fresh operation must not be overwritten by a late acknowledgement for an older one.

Rehearse the boundaries with synthetic data

Use two test devices or isolated clients and a disposable shared list. The following are proposed checks, not claims about a tested implementation:

  • Save offline, terminate the process, and reopen. The pending edit remains visible and can still sync.
  • Interrupt the response after the server commits. Retrying produces one shared effect and recovers confirmation.
  • Edit or delete the same item remotely before reconnecting. The documented conflict policy runs without erasing unrelated changes.
  • Remove sharing permission while the device is offline. Sync is rejected safely, with a useful local recovery state.
  • Switch accounts with pending work. The operation remains bound to its original identity and cannot cross accounts.
  • Fail the local write. The app never reports a durable save that did not occur.

Also test the latest screen state after relaunch and configuration changes. Our first-use localization article covers preserving progress during a language change; offline work adds a pending shared operation that must survive too.

Measure operations, attempts and observation gaps

Define local-save reliability separately from remote completion. A retry is an attempt under one operation, not another useful action. Retain the original action time, local commit and server acknowledgement separately from analytics upload time. Otherwise, reconnection can resemble a burst of new engagement.

For an entirely synthetic review, take 100 observed, durably saved operations from one app release and give each a full 24-hour follow-up from local commit. Seventy-five have confirmed remote completion, ten need conflict decisions, five were rejected, and ten remain unconfirmed. Completion within the window is 75 of 100, or 75%. Later recoveries belong in a separate follow-up, and younger operations are not yet mature.

Unconfirmed does not automatically mean still offline or lost. Telemetry may also be missing. If devices never reconnect, a server-side dataset cannot observe every local save; describe the coverage limit rather than extrapolating these counts to all users. Investigate clock inconsistencies before calculating sync delays.

Keep checklist text, names, account identifiers and raw operation IDs out of general analytics. Use fixed stage and outcome categories there, with necessary reconciliation in controlled operational storage.

AppCradle's aggregate reports do not synchronize checklists or reconstruct individual offline operations. The dashboard reconciliation guide helps separate definitions and reporting windows. Use your own app evidence to find whether work failed at local persistence, authorization, conflict resolution or acknowledgement, then repeat that exact scenario after the fix.

See the bigger picture.

Bring your store reports together and spend more time understanding what they mean.

Try for free