Android - Sockets vs Polling

前端 未结 3 433
暗喜
暗喜 2021-01-13 04:29

As part of an Android app I\'m developing there is a chat room feature. We have a server which can process the incoming messages and store the messages. Is it better to keep

3条回答
  •  梦谈多话
    2021-01-13 04:59

    Polling lacks real-time connection and a persistant connection is battery draining. I think that what you are looking for is a combination of "push"-ing and persistant connection. You would wake your phone via push, and then establish a connection via sockets to handle chat.

    I suggest reading this article. I'm not sure if it mentions c2dm, the google push service.

提交回复
热议问题