Reputation: 2063
Requirement : In an app, During the first launch it is required to download all the images and data from the remote server and store them into sdcard and local sqlite database respectively. And, in the later times, the app works locally without network connection.
So, the HTTP
response comes in JSON
format and it needs to be parsed and stored into the database and the after parsing JSON
I will get the image paths which needs to be downloaded and stored into the sdcard.
Currently, I am thinking to implement this using an AsyncTask
for respective API calls. Please let me know if there any other efficient alternatives OR if there are any sample source codes doing similar task. TIA...
Upvotes: 0
Views: 366
Reputation: 3025
If it really needs to be separate files you can use the Download Manager.
But I would recommend packing and compressing everything into one archive file and download that.
Maybe you can use an Expansion File?
If you decide to use an AsyncTask be aware that depending on your targetSdkVersion (>11) and Android Version (>4.0) it might not run multithreaded without setting a thread pool executor.
Upvotes: 1
Reputation: 24031
Android provides a service for downloading files. Try Download Manager.
Upvotes: 1