+1 vote
by
Hello!
If who faced with the problem of computing the new data, please tell me.
In different mesenger when you get new data in the side menu displays a number of these new data, and when we go to this point - then the circle disappears.
So how to properly implement versioning of the data?
The catch in that when you navigate to a specific menu item opens a form with a list and each list item can contain a circle with a number of new data.
Prompt, please, who faced with this problem. As you have it implemented ?

2 Answers

0 votes
by
Implemented in the following way:
From server get json of the form:
{
"data_array_1": [
{
"id":4,
"count":2
},
{
"id":5,
"count":5
},
{
"id":6,
"count":3
}
],
"data_array_1":[
{
"id":54,
"count":3
},
{
"id":55,
"count":5
},
{
"id":56,
"count":3
}
],

Record this data in SQLite.
After you record get the data to display calling getSupportLoaderManager().getLoader(0).forceLoad()
I update the data every 2 hours and provided that there will come a 200 response code.
Longer I turn on a specific list. For example data_array_1.
Each element of this list contains the id, which I find the number from the database, and deduce the number in a list item, if quantity != 0. At the same time as updating the amount of new data in the side menu.
If you need someone, explain in detail.
+1 vote
by
it all depends on your architecture, there is no single recipe.
For example, the message add Boolean field read and using CursorLoader to show in this circle the number of unread messages.
if you need synchronization between different devices such as client is installed on both tablet and phone, it is convenient to do using gcm

this is the first that comes to mind, perhaps for your architecture optimally different solution
by
afna : user neposredsvenno the user, client application, such as one user may have several devices and each installed your client. If the user for example read the message on your tablet, on your phone it should be marked as read and never appear in the circle
by
In your answer it is not clear that there is a client that is the user
by
afna : and why should he know ? one of customers just sent a request to the server that all read, and the server sends to all clients that the user is that all read
by
GCM does not work, though, because the server does not know which version of data is stored on the client. And should not know because it is contrary to the REST API
...