We have an Android app and an iPhone app (same functionality) that use sqlite to store data locally. Initially, applications do not have data, then at the first start they receive data from a remote server and save them in the sqlite database. The sqlite database is created by the server, and applications download it as a single file, which is then used to purchase applications. The database file is not very large by today's standards, but not tiny - about 5-6 MB.
Now, from time to time, applications must update data from the server. There are several approaches that I can think of:
Download the new full database from the server and replace the existing one. This sounds like the easiest way to deal with the problem, if not for 5-6 MB re-downloads. Applications tell the user if they want to download updates, so this may not be too many problems.
Download the delta database from the server, containing only new / changed records and in some form information about which records to delete. This will result in significantly smaller downloads, but client-side work will be more complex. I will need to read one database and based on what I read, update another. As far as I know, there is no way with sqlite to do something like insert into db1.table1 (select * from db2.table1)
, where db1
and db2
are two sqlite databases containing table1
the same structure. (A complete sqlite database contains about 10 tables, with the largest of which probably containing about 500 records or so.)
Download the data delta in a different format (json, xml, etc.) and use this information to update the database in the application. Same as before: not a big problem on the server side, smaller download size than the full database, but rather painful process for updating.
Which of the three approaches do you recommend? Or maybe there is another way that I skipped?
Thank you very much in advance.
source share