From 6330a78df26cd3138e864d2c83aef7ad0f34ab12 Mon Sep 17 00:00:00 2001 From: MohitMaliFtechiz Date: Tue, 10 Dec 2024 17:36:46 +0530 Subject: [PATCH] Keeping the foreground service active when downloads are paused due to network errors (especially during network fluctuations), as the Download Manager will retry after some time once the connection is restored. --- .../core/downloader/downloadManager/DownloadMonitorService.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/downloadManager/DownloadMonitorService.kt b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/downloadManager/DownloadMonitorService.kt index 4789dec5d..275fc1717 100644 --- a/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/downloadManager/DownloadMonitorService.kt +++ b/core/src/main/java/org/kiwix/kiwixmobile/core/downloader/downloadManager/DownloadMonitorService.kt @@ -502,7 +502,8 @@ class DownloadMonitorService : Service() { private fun getActiveDownloads(): List = downloadRoomDao.downloadRoomEntity().blockingFirst().filter { - it.status != Status.PAUSED && it.status != Status.CANCELLED + (it.status != Status.PAUSED || it.error == Error.WAITING_TO_RETRY) && + it.status != Status.CANCELLED } private fun updateNotification(