G
G
geron2016-05-17 13:47:04
Android
geron, 2016-05-17 13:47:04

How to notify the device about changes on the server?

Hello!
There is a task to implement user notifications if there were changes on the server. There are two options for implementing this task:
1 - The server itself notifies the user's device (Sorry in advance, this is my idea, perhaps there is no such way).
2 - Implement a mechanism on the device that will periodically send a request to the server and notify the user about changes on the server.
Which of the options is preferable?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg Gamega, 2016-05-17
@geronix

the simplest and least labor intensive is gcm

R
Rou1997, 2016-05-17
@Rou1997

maybe there is no such way.

There is such a way, instead of HTTP, you need to use TCP / IP directly, we establish a connection, and the server, when it wants, sends a packet to the device, and the device can also do this for its part, there is no need to send a packet (request) to receive a response packet.
Or at least use Long Polling, this is a long, not frequent polling, this reduces the frequency of requests, it's much easier to do, while the server is still an HTTP server, but better than TCP / IP.
Obviously, the first one is less load on the network and on the processor, there is no "useless" load on the network, I think that the battery will be discharged somewhat more slowly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question