My app downloads some assets from my server using an AsyncTask and I put them in a folder on the SD Card. Then, I use these assets in my buttons backgrounds. Everything works, but I’m wondering the best practice to use when I change my assets on the server side. In fact, at the moment, I’m not able to know if the server asset is a new one compared to the one stored locally. However, I was thinking about two possible solutions:
1) The app checks the server for new files, e.g. twice a day. If new files are there, then download them and upgrade the storage locally. In this case: how can I get the time difference between the local and the server file? In other words, how can I know that the server asset is a new one compared to the local one?
2) The server send a notification to the client when a new file is available. How can I manage that?
What is the best choice between the two above?
You can have an assets version number for your assets. Every time your app starts, you can request the latest assets version number. if its larger than the version number you have stored, you know that the images have changed and you can download the latest images. Every time images changes in the server, make sure you increase the version number.
You should also store the version number when you retrieve assets from the server.