In my application I need to upload files to parse server and download them. Since I need operations to keep running even when app is closed, I run Service and do the tasks(upload and download) in the service.
I need callbacks to show the progress and success or failure message in notification. Notification has an action button to cancel download or upload so when the button is clicked, I call parseFile.cancel() and stop the service.
But the problem is that cancel() doesn’t work properly. The progress callback is still being called but with an undefined behavior. Percent done will be like : 4, 13, 31, 2, 1, 54, … Also when I try to upload or download another file after cancelling one, the progress is too slow because the other thread is still actually running. What to do?
I need to mention that handling MultiThreading with AsyncTask or similar classes is not an option because I can not get any progress.
If you share the relevant part of the code and logs that you have, it may be easier for someone to understand and help.