Send data from server to android application [closed]
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.
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.[RECOMMENDED] Use
TCP mode
of communication between mobile and server. I recommend this because in TCP connectivity, server canpush 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
精彩评论