Skip to content
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

Open
mkatsevVR opened this issue Nov 23, 2024 · 9 comments · Fixed by #4108
Open

Download stops when the app is backgrounded #4106

mkatsevVR opened this issue Nov 23, 2024 · 9 comments · Fixed by #4108
Assignees
Milestone

Comments

@mkatsevVR
Copy link

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:

  1. Go to the download tab
  2. Click on any large item (eg wikipedia top 50000 articles)
  3. Download starts, see the notification showing progress.
  4. Switch away to another app.
  5. After a short period of time (less than a minute) the download notification disappears
  6. Go back to kiwix, the download is shown as pending
  7. Pause/unpause, the download resumes.

Environment

  • Version of Kiwix Android : 3.11.1
  • Device : Pixel 9
  • OS version : Android 15
@kelson42
Copy link
Collaborator

Does that still happen with 3.12 (nightly)?

@mkatsevVR
Copy link
Author

Where is the nightly apk?

@kelson42
Copy link
Collaborator

Where is the nightly apk?

http://download.kiwix.org/nightly/

@mkatsevVR
Copy link
Author

Same thing on the nightly, except the status is shown as "Paused WAIT FOR RETRY" instead of "Pending" in step 6.

@kelson42
Copy link
Collaborator

@mkatsevVR Thank you for your bug report, we will look at it and come back to you in the next days.

@MohitMaliFtechiz
Copy link
Collaborator

@mkatsevVR, Thanks for opening the issue.
@mkatsevVR, @kelson42, I have tested the scenario that @mkatsevVR is describing. The notification disappears after some time if we move to the other application, which is due to limitations imposed by Android's restrictions on background execution, especially for long-running tasks (in our case, downloading). It can be easily fixed by using the foreground service for this functionality which I will fix shortly. But for stopping the downloading I have not faced this type of issue which @mkatsevVR described(In my case, the downloading continued even when I closed the application) because in the latest nightly we are using the DownloadManager which handles the downloading on its own thread. However, I have not yet tested the scenario where the internet has fluctuated. The status showing "Paused WAIT FOR RETRY" shows when the internet fluctuates.

@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.

@kelson42
Copy link
Collaborator

@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.

@MohitMaliFtechiz
Copy link
Collaborator

MohitMaliFtechiz commented Nov 25, 2024

@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:
Go to the Help screen from the navigation menu -> Send diagnostic report-> it will generate the logs file please attach that file here.

Edited
Please ignore the Notification controls(Pause, cancel) that are not currently working.

@kelson42
Copy link
Collaborator

The notification should be merged, but keeping the issue open so we can investigate the unstable download case. @mkatsevVR Your feedback is important.

@kelson42 kelson42 reopened this Nov 26, 2024
@kelson42 kelson42 modified the milestones: 3.12.0, 3.12.1 Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants