S
S
Semyon Semyonov2016-03-19 19:40:04
Android
Semyon Semyonov, 2016-03-19 19:40:04

How to update data in android app?

I have about 5 tables and about 11 thousand records in my application. Sometimes, the data is updated on the server (available and new ones often appear). Question: how to update them in the application? I can query each entry and compare against each entry from the json, but I think this is very inefficient. Are there any other options or good manners?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
O
one pavel, 2016-03-19
@onepavel

I would on the server, updating the data, write down the update time stamp next to it, and from the mobile phone I would make a request if there are new updates after the last data update time stamp on the device

P
Pavel K, 2016-03-19
@PavelK

Rules of good manners say that it is worth updating only what is really needed.
That is, if the data is on the screen or further calculations of what is on the screen depend on it, then it is worth updating.
As I see it:
the server sends a message that the data has changed (any, but for example only for some tables that the application is subscribed to notifications about),
the application sends in response a request to select only the necessary data
. How exactly - there are many ways. For example, the least hemorrhoidal (as in my opinion) is through sockets.

N
Neonoviiwolf, 2016-03-19
@Neonoviiwolf

I would probably use the update number, if it does not match, then the server itself sends what needs to be changed, i.e. keep a log of changes so that the server knows by number what needs to be uploaded

P
Peter, 2016-03-19
@petermzg

It all depends on how you are going to work with this data.
- Sometimes it's possible to just specify the time of creation and update in each entry, then it is possible to simply request those that have a creation or update date greater than the desired one.
- If the records are permanently grouped, then it is possible to get md5 from their data and then query the difference.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question