开发者

Send data from server to android application [closed]

开发者 https://www.devze.com 2023-02-16 17:11 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. 开发者_运维百科 Closed 9 years ago.

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 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.

  1. 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.

  2. [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.


You'll want to look into Android Cloud To Device Messaging. Here's an excellent post from the official developer's blog: http://android-developers.blogspot.com/2010/05/android-cloud-to-device-messaging.html


Use Google Cloud Messaging for Android: http://developer.android.com/google/gcm/index.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号