How to download assets even while app is in background?

I just played Hearthstone and it was downloading 1GB of assets and told me to wait. The app also says that I could open other apps while it downloads. I’m not aware of any way to run code in Unity while outside the app in either iOS or Android. My question is how does it do that?

PS. I experienced this with my Android 6 phone, if that matters.

I found this. It uses Native code for Android. java - How to download files in background regardless of Application state? - Stack Overflow

I wonder if something similar can be done on iOS…

Just in case someone is still interested in this topic - please PM me as i have a working prototype (works on mobile).

The asset is now available on the Unity asset store: Background Download | Network | Unity Asset Store

Please provide any feedback you have on it (how useful it is, any bugs you see or feature requests, etc).
You can reply directly here or send me an email to: liortal53@gmail.com

Looking forward to hearing your feedback :slight_smile:

1 Like

Does the plugin support re-downloading if download fails ?

If your target platform is Android, iOS or Universal Windows, then you can use this:

Yes that is similar to my plugin, but lacks a few small optimizations I’ve done to make it more suitable for real world usage (mostly performance reasons).

The open source project looks nice as well :slight_smile: