<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/data-layer-rethinking-part-2-offline-first-under-pressure-pntcpjl0y" -->

---
title: Data-Layer Rethinking, Part 2: Offline-First Under Pressure
description: An append-only sync journal replaces 'snapshot and ship' syncing for offline-first Android apps handling GPS, video, and multi-device data. Instead of...
canonical: https://daily.dev/posts/data-layer-rethinking-part-2-offline-first-under-pressure-pntcpjl0y
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Data-Layer Rethinking, Part 2: Offline-First Under Pressure | daily.dev
og:description: An append-only sync journal replaces 'snapshot and ship' syncing for offline-first Android apps handling GPS, video, and multi-device data. Instead of...
og:url: https://daily.dev/posts/data-layer-rethinking-part-2-offline-first-under-pressure-pntcpjl0y
og:image: https://api.daily.dev/og/posts/pNTcpjL0Y.png
og:image:alt: Data-Layer Rethinking, Part 2: Offline-First Under Pressure
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Data-Layer Rethinking, Part 2: Offline-First Under Pressure

**[ProAndroidDev](https://daily.dev/sources/pand)** · 30 min read · 1 upvotes · 0 comments

## Summary

An append-only sync journal replaces 'snapshot and ship' syncing for offline-first Android apps handling GPS, video, and multi-device data. Instead of resending the whole database on every sync, each change becomes a self-contained event with an idempotency key, letting a Worker page through events 500 at a time and resume mid-way after a dropped connection. Location data is batched every 30 seconds instead of written per GPS point, cutting row count by roughly 300 times, and compacted further only when storage pressure is high. Videos upload in resumable 8MB chunks so a tunnel costs seconds of re-upload, not the whole file. Conflicting edits from two devices, like a shared playlist, merge deterministically using CRDTs with fractional positions and last-writer-wins tombstones instead of locks or a central server.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://proandroiddev.com/data-layer-rethinking-part-2-offline-first-under-pressure-b343f653e78b>

## Questions this post answers

### How do I implement resumable video uploads in Android that survive a dropped network connection?

Use a chunked upload protocol similar to tus or S3 multipart, uploading in 8MB chunks and asking the server for the current byte offset before resuming, rather than trusting local state alone. A WorkManager CoroutineWorker with setForeground() and FOREGROUND_SERVICE_TYPE_DATA_SYNC handles long uploads, retrying from the last confirmed chunk via Result.retry() on IOException instead of restarting from zero.

_Developers hardening upload flows against flaky connections can track Android worker patterns like this on daily.dev._

### How do I resolve concurrent edits to a shared list, like a playlist, when two offline devices edit it at the same time?

Use a CRDT instead of operation-based merging tied to list indexes, since positions shift and break naive diffs. Give each entry a unique ID, store its order as a fractional position (a Lww register), mark deletions as tombstones instead of removing rows, and merge fields with a last-writer-wins rule based on logical clocks so every device converges to the identical result without a central server.

_Teams designing conflict-free offline sync for shared state can compare CRDT approaches like this on daily.dev._

### How can I reduce the number of database rows written when logging high-frequency GPS updates in an Android app?

Batch location points into one record every 30 seconds instead of writing a row per GPS fix, which at 10Hz would otherwise generate 36,000 rows per hour. Filtering out inaccurate fixes and parked-car jitter on write, then batching, cuts both payload size roughly 4 times and row count roughly 300 times, with further multi-stage averaging applied only when storage pressure gets high.

_Engineers optimizing high-frequency sensor logging on mobile can follow storage techniques like this on daily.dev._

## Similar posts on daily.dev

- [Offline-First Android Architecture: The Complete Engineering Guide](https://daily.dev/posts/offline-first-android-architecture-the-complete-engineering-guide-4w5ysrp8r) · Medium · 0 upvotes · 0 comments
- [The Complete Guide to Offline-First Architecture in Android](https://daily.dev/posts/the-complete-guide-to-offline-first-architecture-in-android-jhpom6lhe) · droidcon · 0 upvotes · 0 comments
- [Android Data Synchronization: Beyond Room & WorkManager](https://daily.dev/posts/android-data-synchronization-beyond-room-workmanager-ntg9szb81) · Medium · 0 upvotes · 0 comments
- [Local-first is not offline-first](https://daily.dev/posts/local-first-is-not-offline-first-uwgluzdvx) · Lobsters · 2 upvotes · 1 comments
- [Synchronize MySQL and IndexedDB in an Offline-First App](https://daily.dev/posts/synchronize-mysql-and-indexeddb-in-an-offline-first-app-t7qnof3ch) · Planet MySQL · 0 upvotes · 0 comments

---

Tags: [#android](https://daily.dev/tags/android), [#kotlin](https://daily.dev/tags/kotlin), [#offline-first](https://daily.dev/tags/offline-first), [#crdt](https://daily.dev/tags/crdt)

[View this post on daily.dev](https://daily.dev/posts/data-layer-rethinking-part-2-offline-first-under-pressure-pntcpjl0y)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Data-Layer Rethinking, Part 2: Offline-First Under Pressure","url":"https://daily.dev/posts/data-layer-rethinking-part-2-offline-first-under-pressure-pntcpjl0y","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/data-layer-rethinking-part-2-offline-first-under-pressure-pntcpjl0y"},"datePublished":"2026-11-22T14:47:11.850Z","dateModified":"2026-11-22T14:47:48.796Z","description":"An append-only sync journal replaces 'snapshot and ship' syncing for offline-first Android apps handling GPS, video, and multi-device data. Instead of...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c8435db0b9dd7a479d4dda2222e33f64?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/c8435db0b9dd7a479d4dda2222e33f64?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"ProAndroidDev","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"ProAndroidDev","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/656c1eb1f1ef4f91936e86fc16545114","url":"https://daily.dev/sources/pand"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/data-layer-rethinking-part-2-offline-first-under-pressure-pntcpjl0y","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"android,kotlin,offline-first,crdt","timeRequired":"PT30M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"ProAndroidDev","item":"https://daily.dev/sources/pand"},{"@type":"ListItem","position":3,"name":"Data-Layer Rethinking, Part 2: Offline-First Under Pressure"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/data-layer-rethinking-part-2-offline-first-under-pressure-pntcpjl0y#faq","mainEntity":[{"@type":"Question","name":"How do I implement resumable video uploads in Android that survive a dropped network connection?","acceptedAnswer":{"@type":"Answer","text":"Use a chunked upload protocol similar to tus or S3 multipart, uploading in 8MB chunks and asking the server for the current byte offset before resuming, rather than trusting local state alone. A WorkManager CoroutineWorker with setForeground() and FOREGROUND_SERVICE_TYPE_DATA_SYNC handles long uploads, retrying from the last confirmed chunk via Result.retry() on IOException instead of restarting from zero. Developers hardening upload flows against flaky connections can track Android worker patterns like this on daily.dev."}},{"@type":"Question","name":"How do I resolve concurrent edits to a shared list, like a playlist, when two offline devices edit it at the same time?","acceptedAnswer":{"@type":"Answer","text":"Use a CRDT instead of operation-based merging tied to list indexes, since positions shift and break naive diffs. Give each entry a unique ID, store its order as a fractional position (a Lww register), mark deletions as tombstones instead of removing rows, and merge fields with a last-writer-wins rule based on logical clocks so every device converges to the identical result without a central server. Teams designing conflict-free offline sync for shared state can compare CRDT approaches like this on daily.dev."}},{"@type":"Question","name":"How can I reduce the number of database rows written when logging high-frequency GPS updates in an Android app?","acceptedAnswer":{"@type":"Answer","text":"Batch location points into one record every 30 seconds instead of writing a row per GPS fix, which at 10Hz would otherwise generate 36,000 rows per hour. Filtering out inaccurate fixes and parked-car jitter on write, then batching, cuts both payload size roughly 4 times and row count roughly 300 times, with further multi-stage averaging applied only when storage pressure gets high. Engineers optimizing high-frequency sensor logging on mobile can follow storage techniques like this on daily.dev."}}]}
```

