I'm writing an Android chat application right now using Openfire as the xmpp server. The problem is that if I use the Xmpp server for push notification, it is fine for when user is online but it has some issues when user is offline. So is there a way to configure Openfire to let GCM to host the push notification? Is the re such thing as a GCM plugin for Openfire?
We have build an application with almost similar conditions like yours. However, for sending push to offline users we send it through server side.
In your implementation while sending message you can check if the user is offline then you can hit your server api to send push. (Also you can implement the GCM on client side too only you have to know its deviceToken or the GCM id)
XMPP manages the offline messages. So you need to handle only the pushnotification part and need not worry about saving the message.
Related
I have my own app server which communicate with FCM server. And I have Android/iOS mobile apps working well.
I want to set a third party program using Java which send a message to FCM server repeatedly so I can keep tracking my own app server is working fine.
I tried to find a solution but official website mention about upstream message only with Android/iOS app.
Is it possible to send a upstream message to FCM server using Java?
(Or any other good idea to monitor the server? I faced the server sometimes goes down for some reason without notice it :( )
There is currently no way to send upstream messaging other than what is shown in the docs -- currently available for Android and iOS.
Even if you are able to send an upstream message, it wouldn't make sense. The flow of upstream messaging is:
Client App > FCM Server > App Server
So the result/response that you would get when sending a message, should it succeed/fail, will point out the communication between the FCM server and the Client App, not with the App Server.
I have tried registering for GCM from Android and it works fine.
Is there any way I can register for GCM from server side using the gcm-server API?
The mechanic behind GCM message receiving is there is a process running in the background waiting for those messages sent from GCM server before passing to the specific app registered. In the other words, you need a platform to make GCM works or it has no way to receive a GCM message.
So the answer is no. You cannot register your server with GCM since there is no mechanic to send those message back to your server. So far there are only three platforms that support GCM: Android, iOS and Chrome.
My android app uses GCM to send or receive text messages. At first, when a user install my app, it uses the GCM api to get a GCM_id from Google. After getting this long GCM id, app sends this id to my web server to say that this client is registered with that id.
My question is that about this step. Since firstly app gets the GCM id and sends it to my web server, I think, someone can listen the requests of the app and sends dummy GCM_ids for this client (or any other clients if guess my client id format). How can I secure this step to prevent unwanted interrupts and attacks.
While creating gcm_id, if google would send this id to my server also before sending it to client, it would be a solution to my problem. But google sends it to client only directly.
ps: Using ssl is not a solution I think. Because it can also be opened by programs like fiddler .
I am trying to send an upstream message from device to cloud using the new Cloud Connection Server feature of Google Cloud Messaging. I am using the example code in Getting Started guide.
http://developer.android.com/google/gcm/gs.html
I am able to set up the client side and am getting the registration ID. But when I send the
message to the server nothing happens. I am not sure if I need to do some setup at the server end.My basic server requirement is to receive the message from the client and send a response back. I am using a Java based backend server.I could not find anything concrete in the documentation regarding server side set up.
Can anyone please help ?
Yes this is definitely possible
http://developer.android.com/google/gcm/ccs.html
The GCM Cloud Connection Server (CCS) allows third party servers to communicate with
Android devices by establishing a persistent TCP connection with Google servers using the
XMPP protocol. This communication is asynchronous and bidirectional.
You can't just register to GCM at the client side and send messages to your server. That only takes care of the connection between your device and the GCM server.
You have to set up your server's connection to the GCM Cloud Connection Server (CCS) in order to be able to send and receive messages at your server :
GCM Cloud Connection Server (CCS) is an XMPP endpoint, running on
http://gcm.googleapis.com port 5235.
CCS requires a Transport Layer Security (TLS) connection. That means
the XMPP client must initiate a TLS connection. For example in smack,
you would call setSocketFactory(SSLSocketFactory), similar to “old
style SSL” XMPP connections and https.
CCS requires a SASL PLAIN authentication mechanism using
#gcm.googleapis.com (GCM sender ID) and the API
key as the password, where the sender ID and API key are the same as
described in Getting Started.
You can use most XMPP libraries to interact with CCS.
GCS is currently in beta and requires you to apply for it. Quoting the documentation page:
Note: To try out this feature, sign up using this form.
Did you sign up? After that Google should get back to you and give you access to the service.
I am familiar in using xmpp library,for android i'm using asmack library.In Google chat also asmack is used.i can write an application to send/receive messages using xmpp.But now i want to track google chat messages in my application.what ever the user do in google chat the same sholud be happening in my application.Suppose that user logged in google chat,in my appication also he is logged in.Sent messages /Incomming messages also should be in sync.i m able to do every thing except synchronizing outgoing sms.How to capture the packet when user is send a message from google chat into my application. ?
You should not be able to do that (unless rooted) as it would be security issue - anyone could sniff your any network activity that way. If your app sign in to the google talk server (as any other client) then you should receive copies of all the conversations, but that's it.