← All case studiesSwift Medical / Mar 2023 - Oct 2025

Recovering months of stalled document sync

Recovered documents that had been stuck on devices for months and improved stability through synchronization and memory changes.

Senior Android Engineer

≈70% → 99.6%Crash-free users (Crashlytics)
≈24%Lower memory use, whole-app over a full session
≈33%Lower CPU use, whole-app over a full session

Product context and challenge

Swift Medical's clinical Android app had to create documents and capture images without a reliable network. I later moved to its Flutter product and handled native Android and iOS work around the camera and computer-vision stack.

Failed synchronization was the main customer complaint. Pending work was coupled to WorkManager's internal state, and out-of-order operations were rejected by the backend. Some documents remained on devices for months. Long sessions also exposed memory leaks and expensive bitmap and encryption work.

My scope and ownership

  • Moved synchronization state out of WorkManager and into an application-owned queue that preserved document order.
  • Compared memory and CPU behavior in a low-priority Coroutines pilot before migrating the remaining synchronization work.
  • Used Android Profiler and Perfetto to trace long-session leaks to bitmap handling and encryption work that blocked threads.
  • Identified production performance problems during a limited analytics rollout and paused the release until the internal library was fixed.
  • Supported native camera plugins on Android and iOS, enabled ARM64 simulator support for OpenCV and TensorFlow, and migrated C++ dependencies for 16 KB memory pages.

Decisions and trade-offs

  • The product needed to own synchronization state and ordering. WorkManager continued to schedule execution, while the application database held pending domain operations.
  • A measured pilot established whether Coroutines improved the existing thread-heavy implementation before extending the change. I moved the busiest flows first instead of rewriting everything at once.
  • Production behavior determined whether the analytics replacement was ready. I paused the first limited rollout, fixed the internal library with the team, and resumed the release.

Quality, validation, and delivery

  • Used CPU and Memory Profilers, allocation and leak analysis, and Perfetto to investigate long-session failures and blocked threads.
  • Compared resource use before expanding the synchronization migration and monitored adoption and performance during analytics rollout.
  • Compiled OpenCV and TensorFlow dependencies for ARM64 iOS simulators and validated SwiftVision with the computer-vision team before its production release.

Outcomes

  • Documents that had been waiting on customer devices for months successfully synchronized.
  • The application gained explicit synchronization queue ownership and better processing observability.
  • SwiftVision shipped with ARM64 iOS Simulator support, and native-library support for 16 KB pages was delivered by the required deadline.

Supporting technologies

KotlinCoroutinesMVVMWorkManagerRxJavaPerfettoFlutterSwiftOpenCVTensorFlowC++FHIR