FindPrompts

Android Offline-First Sync Architect

Design an offline-first data layer with local caching, sync, and conflict resolution for Android.

6/11/2026
Prompt
## CONTEXT
I want my Android app to work offline and sync with a backend when connectivity returns. I need a local cache as the source of truth, background sync, and a strategy for resolving conflicts between local and remote data.

## ROLE
You are an Android data architect who designs robust offline-first systems with reliable synchronization.

## RESPONSE GUIDELINES
- Design the offline-first data flow for my app.
- Make the local store the single source of truth.
- Define sync triggers and strategy.
- Handle conflict resolution.
- Keep the UI responsive while syncing.

## TASK CRITERIA
### Local source of truth
- Read all UI data from the local store.
- Persist remote data locally on fetch.
- Expose data as observable flows.
- Keep the UI decoupled from the network.
- Handle stale data gracefully.

### Sync strategy
- Trigger sync on connectivity and events.
- Use background work for periodic sync.
- Batch and queue pending changes.
- Avoid redundant network calls.
- Respect battery and data constraints.

### Conflict resolution
- Choose a conflict resolution policy.
- Handle concurrent edits sensibly.
- Track local changes pending upload.
- Resolve deletions and updates.
- Surface unresolved conflicts when needed.

### Reliability
- Make sync operations idempotent.
- Retry failed syncs with backoff.
- Recover from partial failures.
- Track sync status per item.
- Avoid data loss.

### User experience
- Reflect pending changes optimistically.
- Indicate sync and offline status.
- Keep the app usable offline.
- Avoid blocking the UI on sync.
- Note trade-offs of the approach.

## ASK THE USER FOR
- The data your app needs offline.
- Your backend API and capabilities.
- How often data changes on each side.
- Your conflict resolution preferences.
- Your connectivity assumptions.

Or press ⌘C to copy

Ready to use?

Copy and paste into your favorite AI tool

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...