How to inform the device about changes on the server?

Hello!
There is a challenge to implement alerting a user if the server were the changes. There are two implementations of this problem:
1 - the Server notifies the user's device(sorry in Advance, this is my idea, maybe there isn't).
2 - Implement a mechanism on the device which will periodically send a request to the server and notify the user about changes on the server.
Which option is preferable?
July 9th 19 at 13:26
2 answers
July 9th 19 at 13:28
Solution
the easiest and least labor-intensive is gcm
Here, one can see - an adequate response, simply advised his version, so even though I'm not the default, but say thank you, at leisure, look, and it will dissolve SR..h would not protknesh. - mazie.Towne commented on July 9th 19 at 13:31
I advise you to look in the direction of the Firebase. Kind of like this new GCM - pearlie.May commented on July 9th 19 at 13:34
: their prices are really painful bite to pushi use - xavier.Breitenberg21 commented on July 9th 19 at 13:37
https://firebase.google.com/docs/cloud-messaging/#... - pearlie.May commented on July 9th 19 at 13:40
Thanks, just in time for FCM and pereshol. - Larry_Ullrich commented on July 9th 19 at 13:43
July 9th 19 at 13:30
maybe this way no

This method is, instead of HTTP you need to use directly a TCP/IP established connection and the server when he wants, sends the packet to the device, and the device also so maybe its part, there is no need to send the packet (request) to get the response packet.
Or at least to use Long Polling, it's a long and not frequent questioning, so decreasing the frequency of queries, it is much easier to do while the server remains HTTP server, but best TCP/IP.

Which option is preferable?

It is obvious that the first, less load on network and CPU, no useless load on the network, I think that the battery is discharged as little slower.
And the messengers work op this principle? - mazie.Towne commented on July 9th 19 at 13:33
In human terms this is called "push". - pearlie.May commented on July 9th 19 at 13:36
: Yes, instant messaging protocols based on TCP/IP and not HTTP. - xavier.Breitenberg21 commented on July 9th 19 at 13:39
: Is called a "push", and realized - as I was told. - pearlie.May commented on July 9th 19 at 13:42
But if there is no possibility and desires to implement the first option, second you can use? - Larry_Ullrich commented on July 9th 19 at 13:45
: And the second is possible, and an interim solution is (i.e. Long Polling), but as I wrote, will increase the load on the server and the client, if your case is not critical - do. - Larry_Ullrich commented on July 9th 19 at 13:48
TCP/IP is the Protocol stack. HTTP is not on the same level, with no TCP or IP. When asked "what
this chicken" you start out with atoms or molecules? - Art_Christians commented on July 9th 19 at 13:51
: I do my work is not to understand that HTTP is based on TCP/IP, and protocols used in IM systems such as XMPP and WebSockets based on TCP/IP but not HTTP-based.
And chicken from my meat and soy. - mazie.Towne commented on July 9th 19 at 13:54
:
const-string v0, "TAG"

const-string v1, "Davayte vi menia esche is uchit' nizkourovnevomu programmironiyu, i objasniat', kto na kom based! Ya zhe all, all etogo ne znayu!"

invoke-static {v0, v1}, Landroid/util/Log;->i(Ljava/lang/String;Ljava/lang/String;)I - mazie.Towne commented on July 9th 19 at 13:57
: You are clever shit, sir. No one teaches you nothing. Here just want you not duped the head of the beginners. What is TCP/IP? What is Long polling? It is normal for the system methods. Called "push notifications". So Google what you need the vehicle. If every dickhead like you, will kostelich its implementation pushey, our smartphones will be live in a matter of hours. - Larry_Ullrich commented on July 9th 19 at 14:00
: As I understand it, you just offer to take an existing library with the implementation of the "pushey". Well, that would tell of default: there are ready libraries that are called so-and-so, or googling so-and-so, and he'd already decided.
And you first started to explain to me what I already know, only in other words, now again holivar want, "finished vs bike", so again I say unto you narrow your horizons, you saw only those tasks where the required finish, and those tasks which required Exclusive write something of their own, have you seen...
At the end of the review all utter nonsense, a pathetic TCP/IP and the fault of the smartphone, this how to shoot paper bullets. I for default, and then utter horror. - mazie.Towne commented on July 9th 19 at 14:03
Offtopic: "Hark! What's that smell? Yes this is the line of the narrow-minded. Marsh limited thinking!"
Narrow-minded. A narrow Outlook will never change.
On topic: TS, do not pay attention to Rou1997, he soars in the clouds. Use push notifications, as you already wrote in the answers here can see what it is and what it eats (https://developers.google.com/cloud-messaging/). The likelihood that you will have to write your solution to deliver notifications to zero (of course, if you are writing a project-level Telegram, but in this case you wouldn't be asking questions here :) ). - Art_Christians commented on July 9th 19 at 14:06
: Are you trying someone to teach the basics or what? Why tell you how it's done (the more done it is usually much harder and nakostylyat it rukovodstvuyas your advice is almost impossible). In Android Google Cloud Messsaging is the de - facto standard.
What's the fault of the smartphone? I'm talking about that kind of shit-apps that zakostelecky the most can not guzzle the battery as not in itself. It will keep the processor and the radio module enabled.
In the end - the exhaust from your "advice" is 0. - mazie.Towne commented on July 9th 19 at 14:09
: It is not necessary to invent, if I pay well, I was good at writing apps, and know how to optimize them, including, thanks to the knowledge of the basics, up to the "iron", which I repaired, but the finished products is not always optimal, or by other parameters (such as the same RAD), maybe their developers did not see a need or simply could not, and very often Google does not care about the performance of the client is enough for websites to look.
Who "nakostylyat", I'm not responsible, I'm here for advice not to pay, I just answer a question briefly. - mazie.Towne commented on July 9th 19 at 14:12
: As always. All around shit, the one I'm standing in a white cloak beautiful - Art_Christians commented on July 9th 19 at 14:15
: I never say that, it's your thinking. On the horizon I pointed out to you, because you because it does not correspond to the task that is taken here. And employers your may be, that such an Outlook need. - mazie.Towne commented on July 9th 19 at 14:18

Find more questions by tags Android