A
A
Alexey So2016-03-03 14:36:59
Java
Alexey So, 2016-03-03 14:36:59

Is it possible to automate the process of saving data in an Android application?

Are there any ready-made solutions or, let's say, interesting articles that help solve the following problem.
For example, a catalog of goods is stored on the server.
There is an API for accessing sections/elements of this directory.
Way 1.
Download the entire database in SQLITE, but the idea is not very good.
You will have to write a comparison and check for database changes on the server.
Again, I would like to do it universally, now the catalog is small. then it will be big.
I would like
Path 2.
Everything that is viewed in sharedpreferences.
Way 3. Constantly pull the API depending on the entry into a specific section.
Which of these paths is correct?
1. Good for everyone, except for downloading a huge amount of materials in cases of database swelling. Synchronization.
But in principle, I would go this route. Is there any way to quickly match JSON ->SQLite?
3. You can’t look without the Internet (
Please tell us how you act in such situations.
Thank you very much!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Dovnar, 2016-03-03
@SolidlSnake

When you select a category, the entire category is downloaded or, if it is too large, part of it.
The download is saved to your phone in a form convenient for you (SQLite, SP, something else) and used as a cache.
The next time you enter this section, if there is an Internet connection, there are two reasonable ways:
And if at the entrance to the already visited category there is no Internet, then open the already saved cache.
PS In the case of such an implementation, you can also add a button "Download the entire database" and let the user think for himself whether he needs it all or not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question