N
N
Neonoviiwolf2018-04-22 01:17:39
Android
Neonoviiwolf, 2018-04-22 01:17:39

How to organize constant database updates from the server for android?

Good
The task is this, on the server there is a database that sends data to the application on android. The fact is that adding new entries will be frequent, as well as updating existing ones. How would I do it beautifully, so that each time I do not send the entire database. If only an addition, I would send the last id, and in response I would receive something missing, but updating the data is confusing, because each user may have different states of the database relevance. How is this solved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lazard105, 2018-04-24
@Neonoviiwolf

Usually it is done like this:
1) For each table, add an "UpdateDate" column - the date the row was last modified.
1.a) When updating or adding this line to UpdateDate, the current date is set on the server.
2) The user in the synchronization request gives the maximum date from all his UpdateDates - from local ones (the user's UpdateDate does not change - it is set only during synchronization).
3) The server returns only those rows whose UpdateDate is greater than the one passed by the user.
If you need a detailed description with diagrams, then it is here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question