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.

This commit is contained in:
MohitMaliFtechiz 2024-12-10 17:36:46 +05:30 committed by Kelson
parent 9444a3d74b
commit 6330a78df2

View File

@ -502,7 +502,8 @@ class DownloadMonitorService : Service() {
private fun getActiveDownloads(): List<DownloadRoomEntity> =
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(