从服务器发送数据到android应用
什么是在将数据从一台服务器从Android应用程序发送到Android设备的最佳方式?我的当前设置:
What is the best manner in which to send data to an android device from a server from an android application? My current setup:
PostgreSQL数据库 - >程序服务器计算机上运行 - > Android设备。
Postgresql database --> program running on server machine --> android device.
我目前使用的是自定义协议,但我最终想使我的数据源在逃提供给应用程序开发社区。因此,我想知道由我可以为这个数据的最佳和最简单的选择。
I currently am using a custom protocol, but I would ultimately like to make my data source available to the app development community at large. As such, I would like to know the best and most simple options by which I can serve this data.
我读了你需要这个的时候了。我有两个建议供您参考。
I read that you need this right away. I have 2 suggestions for you.
-
HTTP池
。保持移动应用击中到服务器具有限定频率说响应于击中2分钟,服务器可以发送愿望信息到移动设备。这基本上取决于你希望多久服务器联系到移动应用程序的速度。
HTTP Pooling
. keep the mobile application hitting to server with a defined frequency say 2 minutes in response to hit, server can send the desire information to mobile device. This basically depends on the rate how often you expect the server to contact to mobile application.
[推荐]用 TCP方式
移动和服务器之间的通信。我推荐这个,因为在TCP连接,服务器可以推送消息
的移动应用程序,而不在移动应用不断击中服务器。
[RECOMMENDED] Use TCP mode
of communication between mobile and server. I recommend this because in TCP connectivity, server can push message
to the mobile application without the mobile application keep on hitting the server.