0

I want to create a download manager application by using filedownload library on github, but when I download a file and I suddenly close my application (swipe to close app), the download process also stops. When I go to application manager to see whether download service is running or not and it is still running on a separate process. So why does the download process stop?

Could you please show me the way to avoid it being killed even though it is in a separate process? Thanks.

user3684195
  • 27
  • 1
  • 5

1 Answers1

1

The service it probably killed then resumed, that's why the download stops. You should resume the download when the service is restarted. You can save the position of the download when OnDestroy is called, then get that value when OnStart is called. If you do not know how to resume downloads in Java, look at this question

Community
  • 1
  • 1
Niza Siwale
  • 2,390
  • 1
  • 18
  • 20
  • onDestroy is not reliable in a service, it doesn't get called when you would assume it does – Tim Feb 29 '16 at 12:49
  • The service is running on a separate process from the main one. Is it possible to be killed? – user3684195 Feb 29 '16 at 13:06
  • The process doesnt matter. When android runs out of memory or when it's memory is going low, it will kill background tasks – Niza Siwale Feb 29 '16 at 13:48