O
O
Olzhas Ilyubayev2015-11-26 15:30:19
Mobile development
Olzhas Ilyubayev, 2015-11-26 15:30:19

How to implement database loading from the server in a mobile application?

There is a DB (MySQL) on the server with the data.
We also have a client application on Android / iOS with SQLite, which should download data from the server and display them. Similar functionality is visible in 2GIS, where the database is downloaded from the server and then deployed in the application.
I'm interested in the very technology of such a database deployment on the client side - how does it happen?
1) The database dump is downloaded and then it is already used directly by the client.
2) The client receives the database in the form of JSON. After that, it is parsed and inserted into the ready-made client database structure? What if the database is large? After all, then the speed will suffer.
The data is quite voluminous + I want the client to be more offline, so the exchange of information with the server via the REST API is not advisable.
What are some ideas? Maybe there are ready-made solutions or have you had such an experience?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Belyaev, 2015-11-26
@ilyubayev

1. set up logging of changes in the server database
2. at the first connection we get a full copy (except for the log) of the server database
3. during updates, we pull logs that are younger than the last update time and replicate the local database using them
4. hang a cron script on the server that cleans up the logs , which are older than a certain time (for example, older than 3 months, depends on the disk space of the server)
5. if the last update on the client was a long time ago (more than 3 months ago), then you will have to download the entire database again, because the log in this case is not complete

O
Oleg Gamega, 2015-11-26
@gadfi

if the updates are not frequent, then you can simply download the finished sqlite database from the server, or at least do it the first time and then follow the rest api

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question