I have a project to develop an application that implements push technology. I can save the message to a database when I add some message, but my problem is that I can't send (broadcast) the message to the client and I can't implement the client accepting the message (accept broadcast message).
I'm using Spring, Hibernate, and Tomcat for the server, and I've built the client on Android.
I have tried all the links in this question, but I'm still confused about how to implement the source code.
For GCM, an explanation is available here.
For this you need to get an API key for your project from the API console.
Also, you need the Google Cloud Messaging for Android Library which will be available in your Android SDK/extras directory.
And if you are looking for both client & server side examples with explanations, they are explained nicely on this blog.
Related
We are developing step by step game and need to send a notification to all players of current game when someone made his turn. We have a REST server that uses jersey + jackson implementation.
We know that it is possible to use Google Cloud Messaging for this purpose, however it doesn't support windows phone platform (we want to support Android, iOS, Windows Phone). Yes, Microsoft has their own server, but it requires to learn API of 2 services. Also, we found that server sent events protocol exists that can help us.
Is it good idea to use SSE (on all mobile platforms) instead of push notifications or there are some better solutions?
Thanks.
Using SSE is a bad usage for your requirement, as it will only work when your app is running, no notifications will be received when your app is closed.
You should use the notification system of each plateform you target (GMC for Andorid, Apple Push Service for ios, etc.)
Each device needs to register to the notification server and then you can send notifications to registered devices.
Since your targetting multiple plateforms, it would be easier to use a third party service that will do the registering and message dispatching to all your targetted plateforms through a simple API.
As suggested by Rahul Mathur, Parse is a known and reliable provider. Other possibilities include AWS SNS, Urban Airship, PushWoosh, and a lot more !
I suggest you to use parse as it is easy to implement
For android : https://parse.com/tutorials/android-push-notifications
For iOS : https://parse.com/tutorials/ios-push-notifications
You can also customise your php script on parse console.
Currently I am working on instant messaging chat application in which I need to implement third party chat server.
I am following this tutorial
Complete project available on Github here.
When I download this project it provides me with two project folders; the first is named GCMDemo and the second is GCM_CCS_application.
I import GCMDemo in eclipse; it provides me a GCM client for sending message and it's working fine.
But I don't know how to use GCM_CCS_application. This is a java application. GSM_CCS_application is not an android application; it is for server-side applications.
I have openfire server installed on my computer but don't know how to use openfire for this application. So please somebody tell me how to implement this server-side application.
Hope you have figured this out by now, if not read on.. Basically you DO NOT need Openfire for this purpose. Google's server will do the job of Openfire. Your server application and your android application are both "users" or clients of the Google's xmpp server. The applications can connect to the Google server using your project ID and API key. Hope this helps.
Is there any way to login into a GCM server and receive messages from a Desktop Windows C++ application? I want to be able to login into my GCM server using some kind of C++ GCM client.
Thanks in advance,
GCM Client
SEE ALSO
Getting Started GCM Server A GCM client is a GCM-enabled app that runs
on an Android device. To write your client code, we recommend that you
use the new GoogleCloudMessaging APIs. The client helper library that
was offered in previous versions of GCM still works, but it has been
superseded by the more efficient GoogleCloudMessaging APIs.
A full GCM implementation requires both a client implementation and a
server-side implementation. For a step-by-step guide to creating a
complete sample implementation that includes both client and server,
see Getting Started.
I think it is designed for android device.
Probably you can hack and install a whole android somewhere but, buy is easier in this way:
Write an Android client as google expect to a cheap phone (20$) When you receive message send it over wifi to your desktop Apache server via HTTP POST, and problem solved, simple :)
how to create push notification in Android using GCM or either C2DM i have tried and check some sites and didn't get exact answer.i need to know how it works.Can any one provide me good tutorial on push notification
Could anybody help me. Thanks!!
Its Depend on your requirement what you have to do.
here is sample of C2DM: in this sample android device is registered wtih server after that server send massage to all device. so there is one way communication(server to Android device)
So all things are done at server side. just download this tutorial. Both Server side(PHP) and Android code are available.
Edited:
you got application key from Google services which you have to put at server side.
SENDER_ID – Google project id which you have to send when you want to register your device with server.
You can use GCM demo app supported by Google. One needs to install GCM libs using SDK manager and then create API keys in Google APIs console. Follow instructions from the link and you can create an app that receives push notifications from GCM server. I did try this and it worked even on my Android emulators. You need to use Emulator that targets Google APIs though.
How can I send data from a server to an Android device without the device polling for data?
This is called a server side 'push' and is commonly referred to as 'pushing'. This is a well known feature of the iPhone, however, it does not currently exist on the Android. Android Cloud 2 Device messaging has not yet been released to the general development community. you may want to check out projects such as MQTT and Deacon.
You might consider using Googles cloud to device messaging for a solution.
You'll have to sign up for an account and are only able to use AppEngine servers at the moment.
Your application has to use API level 8 (2.2) in order to be able to receive the cloud's pushes.
GCM (Google Cloud Messaging) is the easiest way, and while GCM provides the basic service of sending messages, there are companies out there that do help you get up and running.
You could take a look at companies like urban airship, xtify and mBlox (developer.mblox.com) to get started with this and have a few additional tools that help you structure the push notifications in a more structured way.
Good Luck with your development!