Skip to main content

Posts

Showing posts with the label WorkManager

Adapting to Android 15 Foreground Service 'dataSync' Timeouts

  If your application relies on long-running background synchronization, Android 15 (API level 35) introduces a breaking change that demands immediate architectural refactoring. The days of keeping a Foreground Service alive indefinitely for data synchronization are over. Android 15 enforces a strict  6-hour time limit  on  dataSync  and  mediaProcessing  foreground service types. This is not a "soft" recommendation. If your service exceeds this window, the system invokes the new  Service.onTimeout(int, int)  callback. If the service doesn't stop immediately, the system declares an ANR (Application Not Responding) or kills the app process entirely. This guide provides a production-grade strategy to handle this limitation using  WorkManager  and checkpointing, ensuring your large-scale syncs survive the strict new OS governance. The Root Cause: Why Android 15 Kills Long Syncs Historically, developers used Foreground Services to bypas...