Your Cart
Loading

Data That Survives: Room, DataStore, WorkManager and Offline-First Sync for Android Apps That Still Work on the Subway

On Sale
$19.00
$19.00
Added to cart

Data That Survives is a practical guide to the part of an Android app that decides whether it still works on a subway platform, in a basement gym or on a plane: the data layer. It starts with the offline-first contract from Google's architecture guidance (the local database is the single source of truth, the screen only reads from it, every write lands locally first) and then builds the data module of a small notes app, Field Notes, one layer at a time: Room 3 done properly, DataStore for settings only, WorkManager sync that outlives your process, a sync engine with ETags and idempotent uploads, Paging 3 with a Room-backed RemoteMediator, data protection now that Jetpack Security is deprecated, and fast tests for all of it. Every library version and deprecation was checked against the official Android Developers pages and release notes in October 2026. No benchmarks or speed claims.

What you get

  • The offline-first contract: single source of truth, repositories and data sources, observe-then-refresh reads and the three write strategies from Google's guide
  • Room 3 properly: entities with dirty flags and server versions, Flow DAOs, @Relation and junction tables, indices, transactions, migrations you can test, FTS search, and Room 2 to Room 3 in one table
  • DataStore for settings, not data: Preferences vs typed DataStore, the rules that keep it correct, migrating from SharedPreferences
  • WorkManager: one-time vs periodic (15-minute floor), constraints, unique work so two syncs never run at once, backoff defaults, chaining, expedited and foreground work, TestDriver tests
  • Sync with a backend: Retrofit or Ktor with kotlinx.serialization, pull then push, change tracking, conditional GETs with ETag and If-None-Match, last-write-wins vs server-wins, idempotent uploads
  • Paging 3 with a RemoteMediator and remote keys, and when plain sync is the better answer
  • Protecting the data: why Jetpack Security is deprecated and what replaces it, SQLCipher, data_extraction_rules.xml and what to exclude from backups
  • Testing the data layer: in-memory Room, Turbine for Flows, fakes instead of mocks, Robolectric or instrumented
  • The whole Field Notes data module laid out file by file

65 pages, 22 diagrams plus a chapter-opener graphic for every chapter, an offline-first checklist and a cheat sheet. PDF and EPUB. Android the Right Way, Book 6.

Not sure yet? Read the free sample first: the cover, the full table of contents and all of Chapter 4, "WorkManager: Sync That Outlives Your App" (a CoroutineWorker that knows transient from permanent errors, one-time vs periodic work, constraints, unique work with KEEP, retry and backoff, chaining, expedited and long-running work, observing work from the UI and testing workers), at https://payhip.com/b/Bo5hI


Also in a bundle: Everything Bundle: every ebook in the store, $89 ยท Homelab Bundle, $59.

You will get the following files:
  • PDF (3MB)
  • EPUB (3MB)