I am designing an application that will retrieve .zip files from a server and extract them to the sdcard on reception.
I think i can figure out the extracting, but I am not sure what the best way to send the .zips from the server is. It only need to be one way for now but in the future I would like to add version control if that matters.
I did some research and looked into JSON but I could not find any examples of that sending .zip files. A http connection seems like a comparable option and I know I could receive .zips but I don’t think version control would be as easy to implement. Any suggestions for either of these two methods or if you think another way would be better, I’m open to that too.
Use a manifest file and get that first. Examine the manifest file (a file that contains a list of other files) and see if your local storage contains those files. If it does – everybody’s happy. If it doesn’t then get the files that your manifest lists onto your local storage.
Don’t use the code as mentioned above directly. Use some UI feedback to tell the user that you’re downloading some files (and preferably ask them first in case they want to swap to wifi). Getting the manifest first is ok, just don’t get the missing files without asking them.
I do this for my game “barcode beasties” which downloads approx 20Mb of audio assets on first run. I can also add further audio bits without having to push out a new release. Android is also clever enough to unzip zip files, but again, make sure you are telling the user what’s happening and give them the ability to cancel or back without killing your main activity thread.