-
-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Download stops when the app is backgrounded #4106
Comments
Does that still happen with 3.12 (nightly)? |
Where is the nightly apk? |
|
Same thing on the nightly, except the status is shown as "Paused WAIT FOR RETRY" instead of "Pending" in step 6. |
@mkatsevVR Thank you for your bug report, we will look at it and come back to you in the next days. |
@mkatsevVR, Thanks for opening the issue. @mkatsevVR I will provide you the APK after fixing the notification issue by adding some additional logs in that APK which will help us to debug the problem in your device. |
@MohitMaliFtechiz Thank you. To me it is really important we use @mkatsevVR willingness to fix the problem(s) to better understand what goes wrong in his use case... and then fix it/them. |
@mkatsevVR Thanks for your patience. Can you please try this APK https://drive.google.com/file/d/1x4aIJ7BlYBAfzEH_KtxhWxmiSg83vJYm/view?usp=sharing and try the same steps as you were doing before, and let us know the issue still exist at your end? if exist then after reproducing the error please share the device logs with us. For sending the device logs: Edited |
The notification should be merged, but keeping the issue open so we can investigate the unstable download case. @mkatsevVR Your feedback is important. |
The notification doesn't go away this time, but nothing is getting downloaded (progress bar doesn't move at all for over an hour), the status is shown as "in progress". |
Similar to #4113, it seems we have a massive regression here. Should be fixed in top priority. |
@mkatsevVR Thank you for the logs, and your feedback. |
Stumbled across this when searching for something else. Just to say it might be failing because library.kiwix.org is down and has been so for at least 8 hours. Maybe was down yesterday evening too? |
@Jaifroid This problem is not related to the down server, it is old problem. 11-29 14:19:15.306 24142 24384 E DOWNLOADING_STEP: updateNotification: DownloadModel(databaseId=1, downloadId=34, file=/storage/emulated/0/Android/media/org.kiwix.kiwixmobile/Kiwix/wikipedia_en_all_mini_2024-04.zim, etaInMilliSeconds=0, bytesDownloaded=-1403397573, totalSizeOfDownload=-1189632026, state=DOWNLOADING, error=NONE, progress=-1, book=org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity$Book@53acc78c)
11-29 14:19:15.314 24142 24384 E DOWNLOADING_STEP: updateDownloadStatus:
11-29 14:19:15.531 24142 24142 I ImeTracker: org.kiwix.kiwixmobile:7c3b815d: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT fromUser true
11-29 14:19:16.215 24142 24142 I ImeTracker: org.kiwix.kiwixmobile:ed17c3f1: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT fromUser false
11-29 14:19:16.216 24142 24142 D AutofillManager: view not autofillable - not passing ime action check
11-29 14:19:16.216 24142 24142 D AutofillManager: view not autofillable - not passing ime action check
11-29 14:19:16.216 24142 24142 W WindowOnBackDispatcher: sendCancelIfRunning: isInProgress=false callback=androidx.appcompat.widget.Toolbar$Api33Impl$$ExternalSyntheticLambda0@7ca1f31
11-29 14:19:16.232 24142 24142 I ImeTracker: org.kiwix.kiwixmobile:facc40e1: onRequestHide at ORIGIN_CLIENT reason HIDE_SOFT_INPUT_CLOSE_CURRENT_SESSION fromUser false
11-29 14:19:19.873 24142 24142 D LeakCanary: Watching instance of androidx.constraintlayout.widget.ConstraintLayout (org.kiwix.kiwixmobile.nav.destination.library.OnlineLibraryFragment received Fragment#onDestroyView() callback (references to its views should be cleared to prevent leaks)) with key f54e9441-bcf3-4b15-bc7b-d0848fe34ccc
11-29 14:19:20.278 24142 24335 E DOWNLOADING_STEP: checkDownloads: lock
11-29 14:19:20.284 24142 24335 E DOWNLOADING_STEP: checkDownloads:
11-29 14:19:20.298 24142 24384 E DOWNLOADING_STEP: updateDownloadStatus:
11-29 14:19:20.300 24142 24384 E DOWNLOADING_STEP: updateDownloadStatus:
11-29 14:19:20.300 24142 24384 E DOWNLOADING_STEP: shouldUpdateDownloadStatus:
11-29 14:19:20.303 24142 24384 E DOWNLOADING_STEP: updateNotification: DownloadModel(databaseId=1, downloadId=34, file=/storage/emulated/0/Android/media/org.kiwix.kiwixmobile/Kiwix/wikipedia_en_all_mini_2024-04.zim, etaInMilliSeconds=0, bytesDownloaded=-1385899461, totalSizeOfDownload=-1189632026, state=DOWNLOADING, error=NONE, progress=-1, book=org.kiwix.kiwixmobile.core.entity.LibraryNetworkEntity$Book@53acc78c) |
@mkatsevVR Thanks for providing the logs, we have fixed the problem in #4118. Can you please try this APK and let us know the problem is fixed or not for you https://drive.google.com/file/d/1x4aIJ7BlYBAfzEH_KtxhWxmiSg83vJYm/view?usp=sharing |
@mkatsevVR Any feedabck? I will merge the fix and this will close the issue... but we would be glad to know if it works now for you. |
no, still the same problem: after a few minutes with screen off the notification disappeared and the status in the app is shown as WAITING_FOR_RETRY |
but the progress bar does work now, so that's fixed at least |
@mkatsevVR Can you please tell me:
Since now we are using the
Thank you for the confirmation. |
I'm on WiFi, I don't think there's any problem with the connection.
If I keep using the phone while it's downloading, everything is fine. If I
turn the screen off, the download stops. It must be some power saving or
inactivity thing that breaks the download or pauses the network connection
when the phone is idle.
Another issue is that when I turn the phone back on, the download doesn't
resume on its own, I have to go back into the app and unpause it.
…On Mon, Dec 9, 2024, 6:16 AM MohitMaliFtechiz ***@***.***> wrote:
no, still the same problem: after a few minutes with screen off the
notification disappeared and the status in the app is shown as
WAITING_FOR_RETRY
logs1733702512510.txt
<https://github.com/user-attachments/files/18054627/logs1733702512510.txt>
@mkatsevVR <https://github.com/mkatsevVR> Can you please tell me:
- On which network you are trying to download the ZIM file, over WIFI
or mobile network?
- Do you have the stable network connection?
Since now we are using the DownloadManager for downloading the ZIM files
which manage these all scenarios by own. WAITING_FOR_RETRY means there is
some network error occurred and the download manager is waiting before
retrying the request.
but the progress bar does work now, so that's fixed at least
Thank you for the confirmation.
—
Reply to this email directly, view it on GitHub
<#4106 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG6SPPBTOBLTDU5RZBJZTD2EV3XBAVCNFSM6AAAAABSLIEGXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRXGYZTANRQGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I've also checked all battery/network related phone settings I could find
and didn't see anything enabled that would limit background usage
…On Mon, Dec 9, 2024, 10:07 AM Max Katsev ***@***.***> wrote:
I'm on WiFi, I don't think there's any problem with the connection.
If I keep using the phone while it's downloading, everything is fine. If I
turn the screen off, the download stops. It must be some power saving or
inactivity thing that breaks the download or pauses the network connection
when the phone is idle.
Another issue is that when I turn the phone back on, the download doesn't
resume on its own, I have to go back into the app and unpause it.
On Mon, Dec 9, 2024, 6:16 AM MohitMaliFtechiz ***@***.***>
wrote:
> no, still the same problem: after a few minutes with screen off the
> notification disappeared and the status in the app is shown as
> WAITING_FOR_RETRY
>
> logs1733702512510.txt
> <https://github.com/user-attachments/files/18054627/logs1733702512510.txt>
>
> @mkatsevVR <https://github.com/mkatsevVR> Can you please tell me:
>
> - On which network you are trying to download the ZIM file, over WIFI
> or mobile network?
> - Do you have the stable network connection?
>
> Since now we are using the DownloadManager for downloading the ZIM files
> which manage these all scenarios by own. WAITING_FOR_RETRY means there
> is some network error occurred and the download manager is waiting before
> retrying the request.
>
> but the progress bar does work now, so that's fixed at least
>
> Thank you for the confirmation.
>
> —
> Reply to this email directly, view it on GitHub
> <#4106 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAG6SPPBTOBLTDU5RZBJZTD2EV3XBAVCNFSM6AAAAABSLIEGXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRXGYZTANRQGQ>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
@mkatsevVR Thanks for the detailed information. It would be very helpful in debugging. |
@mkatsevVR Thanks for the detailed information. Can you please try this APK https://drive.google.com/file/d/1x4aIJ7BlYBAfzEH_KtxhWxmiSg83vJYm/view?usp=sharing, and do let us know if the problem is fixed or not at your end? |
I think it's better now but still not fully fixed. The test I did was to
start a large download, turn the screen off, wait 20 minutes, then turn the
screen back on. The good news is that the notification no longer
disappears. It shows "pending" and the download has not made much progress
while the screen was off. However the download automatically resumed
without having to open the app.
So it seems like now the phone going to sleep no longer breaks the download
completely, but it still gets paused while the phone is asleep.
…On Tue, Dec 10, 2024, 8:36 AM MohitMaliFtechiz ***@***.***> wrote:
@mkatsevVR <https://github.com/mkatsevVR> Thanks for the detailed
information. Can you please try this APK
https://drive.google.com/file/d/1x4aIJ7BlYBAfzEH_KtxhWxmiSg83vJYm/view?usp=sharing,
and do let us know if the problem is fixed or not at your end?
—
Reply to this email directly, view it on GitHub
<#4106 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG6SPN6X5ARTZZTQGNUIXT2E3U67AVCNFSM6AAAAABSLIEGXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZRGY2TQMZWHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@mkatsevVR Thank you for your feedback! We now know that the issue with tracking the download progress while the device is in sleep mode has been resolved. It successfully tracks progress, and if the download is paused (due to network throttling or certain device settings), it automatically resumes when the device is turned on. However, I have also tested your scenario on my Pixel 7a (Which I today upgraded to Android 15) and was able to reproduce the error you mentioned. The download pauses after 15 minutes of sleep mode. This error is only happening in Android 15 devices, in below Android 15 devices it is working fine. It needs some more research I will get back to you ASAP. |
Glad to hear you're able to reproduce it, hopefully it will make it much
easier to debug :)
…On Thu, Dec 12, 2024, 7:24 AM MohitMaliFtechiz ***@***.***> wrote:
I think it's better now but still not fully fixed. The test I did was to
start a large download, turn the screen off, wait 20 minutes, then turn the
screen back on. The good news is that the notification no longer
disappears. It shows "pending" and the download has not made much progress
while the screen was off. However the download automatically resumed
without having to open the app. So it seems like now the phone going to
sleep no longer breaks the download completely, but it still gets paused
while the phone is asleep.
@mkatsevVR <https://github.com/mkatsevVR> Thank you for your feedback! We
now know that the issue with tracking the download progress while the
device is in sleep mode has been resolved. It successfully tracks progress,
and if the download is paused (due to network throttling or certain device
settings), it automatically resumes when the device is turned on.
However, I have also tested your scenario on my Pixel 7a (Which I today
upgraded to Android 15) and was able to reproduce the error you mentioned.
The download pauses after 15 minutes of sleep mode. This error is only
happening in Android 15 devices, in below Android 15 devices it is working
fine. It needs some more research I will get back to you ASAP.
—
Reply to this email directly, view it on GitHub
<#4106 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG6SPOD5EZNJBWRTTW35N32FF6BPAVCNFSM6AAAAABSLIEGXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZYG43DGMBTGA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@kelson42, @mkatsevVR I came with my research. It is not a bug it is an Android feature. When we lock our screen, after some time(Differ according to manufacture, for me in Pixel 7a it goes after 2 minutes) the device goes into the "Doze" mode for battery optimization, and in Doze mode they Since we are using the
So to properly fix this issue: We have to enable the DownloadManager's notification, but unfortunately, it does not have the pause button. So we would not be able to pause the download from the notification. |
… On Fri, Dec 13, 2024, 6:46 AM MohitMaliFtechiz ***@***.***> wrote:
@kelson42 <https://github.com/kelson42>, @mkatsevVR
<https://github.com/mkatsevVR> I came with my research. It is not a bug
it is an Android feature. When we lock our screen, after some time(Differ
according to manufacture, for me in Pixel 7a it goes after 2 minutes) the
device goes into the "Doze" mode for battery optimization, and in Doze mode
they Suspends network access due to this the downloads are pausing. See
restricting of Done mode
<https://developer.android.com/training/monitoring-device-state/doze-standby#restrictions>
Since we are using the DownlaodManager for downloading the ZIM files, and
we are hiding the default DownloadManager notification and showing our
custom notification with pause/resume buttons(Because download manager does
not have the pause/resume button feature). So due to this, when the device
goes into Doze mode DownloadManager pauses the download(Probably it is
giving less priority to our downloads since we are hiding it's by default
notification, so it is thinking that the user is not aware of ongoing
download that's why it is pausing the download in Doze mode).
- If I configured the DownloadManager to show its own notification
then the download keeps running in the background. But now there are two
notifications are showing for the same download(Our custom notification,
and the download manager notification).
- The second option to disable Doze mode for our application does not
work for us, because DownloadManager manages independently from our
application. Also, it is not recommended by Google to use this mode unless
our core feature is not dependent on this see
https://developer.android.com/training/monitoring-device-state/doze-standby#support_for_other_use_cases
By the way using this will not work for us.
- A single approach is working in the current scenario is "Plug your
mobile in charging", in this scenario download is continuing running in the
background, because the phone not going into Doze mode.
—
Reply to this email directly, view it on GitHub
<#4106 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG6SPJO4GX53MNDYQFTMC32FLCIJAVCNFSM6AAAAABSLIEGXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNBRGI3DOOJSGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
To me this is OK if we can only pause from the software itself. Not great, but preferable to a situation where the download pauses itself all the time. |
@mkatsevVR We are already using the foreground service for tracking the progress of |
@mkatsevVR Thanks for your patience, we have fixed this issue by enabling the DownloadManager's notification in #4130. Can you please try this APK https://drive.google.com/file/d/1x4aIJ7BlYBAfzEH_KtxhWxmiSg83vJYm/view?usp=sharing and give your feedback. |
Somehow it's worse than the previous version. Basically the same behavior
as 2 fixes ago, the notification disappears after sleep, the download stays
paused until I go into the app and resume it manually.
…On Mon, Dec 16, 2024, 7:36 AM MohitMaliFtechiz ***@***.***> wrote:
@mkatsevVR <https://github.com/mkatsevVR> Thanks for your patience, we
have fixed this issue by enabling the DownloadManager's notification in
#4130 <#4130>. Can you please
try this APK
https://drive.google.com/file/d/1x4aIJ7BlYBAfzEH_KtxhWxmiSg83vJYm/view?usp=sharing
and give your feedback.
—
Reply to this email directly, view it on GitHub
<#4106 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG6SPI5FD66H3ZF6FYLS7T2F3CLLAVCNFSM6AAAAABSLIEGXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNBVGUYTKNZSHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@mkatsevVR I have forcefully enabled the idle mode in my device and started downloading Bookdash which is a 10.9GB file, and close the application and then lock the screen for 30 minutes. After 30 minutes I unlocked the screen, and the download continued in the background with this new APK.
|
Describe the bug
Downloading an archive only works if the app is open and the phone screen is on. If the app is in the background or the phone is asleep, the download stops.
Expected behavior
The download should continue in the background.
Steps to reproduce the behavior:
Environment
The text was updated successfully, but these errors were encountered: