-->

Downloading files in API <9

2019-05-06 14:58发布

问题:

I just realized that my app, with over 300 users still using an Android version under Gingerbread, is having issues for them because they dont have the DownloadManager that was introduced in API 9 (2.3). Is there a compatibility library or something that I can use or is my best best just to use an asyncTask to download the files manually?

回答1:

Is there a compatibility library or something that I can use

No, DownloadManager is not in the Android Support package. I took a look at making my own backport a while ago and concluded that it was way too complicated, since it has its own content provider and whatnot.

is my best best just to use an asyncTask to download the files manually?

If the files are large, I would consider an IntentService over an AsyncTask, so the download can be better decoupled from the UI. But, regardless, you do need to download it yourself.