Demonstrates use of ThreadpoolExecutors , Dagger , Retrofit ,Foreground Service(master branch - Java, Kotlin branch - kotlin)
Scenario
- Need to download multiple files parallelly in the background
- Show progress of download in the notification tray
Used Components
- Dagger2 for dependancy injection(helps create and maintain the same retrofit object for all the dowloads)
- ThreadPoolExecutors (best for the scenario, when there are lots of files to download)
- Service component which assigns the job to threads in the pool
- When the task is removed from recents, the downloads continue as the service is upgraded to run in foreground.
Out of scope
- Not checking the internet connection- but code can be extended for the same