0

The Android App targeting Android 9 and above is not been able to access the network in Doze mode. Have implemented a background sync service that pulls data from the central server in regular intervals. It all works till the time it enters into Doze mode where the Android 10 device can't access the network. I can see the foreground service initiating the sync process in regular intervals but because of network inaccessibility can't proceed further. I can't use High priority Google Cloud Message as the sync needs to be initiated from the device.

There are few questions asked on the topic but they are all outdated.

As per Google documentation https://developer.android.com/training/monitoring-device-state/doze-standby have tried everything. The app is in the whitelist of Non optimized App list in the device manually so don't need to call request_ignore_battery_optimizations

  • Alarm Manager with setExactAndAllowWhileIdle() and with/without request_ignore_battery_optimizations: Device wakes up in Doze mode but because of no network can’t perform sync

  • Foreground service and with/without request_ignore_battery_optimizations: Device wakes up in Doze mode but because of no network can’t perform sync

  • Foreground service with Wake locks: Don't work in Android 9 onwards

  • Always Screen On: Not recommended as the battery will be drained because of overnight syncs

Any advice will be much appreciated.

demonaxa
  • 1
  • 2
  • You can try to use foreground service, for more info check this: [Android doze mode and foreground service](https://stackoverflow.com/questions/44804432/android-doze-mode-and-foreground-service?rq=3). – Jianwei Sun - MSFT Aug 15 '23 at 06:31
  • @JianweiSun-MSFT, that's correct that foreground service can perform during DOZE mode but this can't establish a network connection. As per my requirement, I need to sync with the central server which requires a network connection. With foreground service in doze mode, I can see the app trying to sync but failing to establish network connection. – demonaxa Aug 15 '23 at 09:28

0 Answers0