simultaneously download files in Android
I'm writing app for android device, which is simple download manager. I want to download 2/3 files simultaneously, but I'm really confused how to do it.
I don't want use async task because it could be killed and I want to run download in background. So I think I should use IntentService, but I can run only one IntentService at time. I have two ideas, how to do it, but I don't know which one to choose. First is to run intentservice inside AsyncTask and second is to run thread inside intentservice. But either ways I don't know how to inform IntentService about new file to download, while another download is already running. Or maybe I should use开发者_StackOverflow社区 traditional 'implement Runnable'?
I'm writing app for Android 2.2, so I don't have an DownloadManager service :/.
Thanks in advance for any help
AsyncTask is exactly what you want if the download happens while an Activity is up. Don't forget though that services can be killed just as as an application. Another option is a service that spawns one thread per download.
精彩评论