Skip to content Skip to sidebar Skip to footer

How Can I Get Data To Be Pushed From The Database To The Client, Like A Messenger Service?

I am trying to code a messenger service that will store sent messages in a server and then push the message to all devices connected to the server. The messenger will be used in a

Solution 1:

Yes, what you are suggesting is named "polling" => check if the server has some updates each 10sec or something like that. You're right, it's evil (drains the battery, use a lot of bad=ndwidth, etc.)

What you need is a "push" service. If you are working with Android, the easiest way of doing it is to use GCM (Google Cloud Messaging) : http://developer.android.com/google/gcm/index.html

This little guy will provide you a way of notifying all the devices that theure have been some changes on the server.

It's pretty well done (if it can't reach the devices, it will try again with an exponential time delay, etc.).


Solution 2:

You can use google cloud messaging service to send notification in device so please register your application on google service all step are cover below link. Open below link and follow step

http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/


Post a Comment for "How Can I Get Data To Be Pushed From The Database To The Client, Like A Messenger Service?"