This is more of a clarification question rather than a problem.
I have been making an android app for our Capstone project and we are stuck with this IM chat issue.
We went with the XMPP Ccs endpoint that GCM provides for upstream as well as downstream messaging.
The funny thing is that the library to achieve this is Smack by igniterealtime still maintained and the only library for Java.
The implementation that google provides in their website GCM Ccs is for older version of Smack. I have got the code up and running but somehow gcm doesnt send me a notification for downstream messaging.
That means i am not able to connect to Gcm Ccs endpoint?
And one more thing i dont know if its connected to Ccs or not because its hosted on Openshift and i have used servlets using Jersey library to achieve it and i dont know a way to debug it.
I guess Tomcat server locally hosted would be fine but anyways i havent tried it, we are short on time anyways.
For the new version of Smack library the code completely breaks.
And i am not a pro with XMPP protocol or Smack Library either.
I just somehow got the code working with the older Smack library. I feel that my implementation is fine.
And if you want i can send you the Eclipse Java EE project for you.
The registration part for the app works fine btw.
So the Questions :-
1 -> Does GCM CCS endpoint accept only :- connection = new XMPPTCPConnection() from smack api and have stopped the connection for connection = new XMPPConnection(config);
2 -> Do Paas services like Openshift doesnt allow connection to Gcm Ccs (I have my third party app server hosted on Openshift)
3 -> Anything wrong with my approach to implement IM for android app?
Thank you! Constructive suggestions as well as criticisms is absolutely welcome.
UPDATE
I fixed the above problems and everything works fine. But i have stuck to a new one. I get ack and receipt packets GCM CCS sends me but i dont get any notification when i send a downstream message.
Any problem with my Broadcast Reciever? I dont think so since it looks fine.
Where can be the problem?
Related
I want to add chat module to android app. Firstly I want to use XMPP using Nodejs. How nodejs xmpp server works with android client.
Can nodejs xmpp server can communicate with android app? if yes than, how can i create simple nodejs xmpp server and simple android app that both can communicate.
If you have any other solution please let me know.
I am tried socket.io but i dont want to use that. It is not worked stable on android client side. Some messages send some not send. I am used few solutions for solve this problem (ping pong, heartbeath, change java client libraries for socket io, ...). But nothing changed.
My aim is to create stable fast chat module to android and ios application using with nodejs server.
Please guide me, thank you in advance.
Have you tried checking other solutions like ConnectyCube, Firebase, Layer, etc.?
They provide a ready backend and all you need to care about is configuring your client-side app.
Some of them even have ready Android client-side libraries which can be integrated in your app and speed up the development.
I am building the java backend for an app (android & ios) which has a messenger function integrated.
I was playing around with openfire and ejabberd the last days and was wondering how i can solve my problem - I want to catch all messages from and to Server for
log messages to custom history file
send push notifications to android & ios client when offline.
Has anyone implemented something like this yet? I have read something about a xmpp proxy doing that work but i really dont know how to start.
thanks in advance.
- bob
1: log messages to custom history file: For Openfire, you can write your custom plugin with packet interceptor and you can log information as per your business needs. You can definitely find opensource plugins for this, but as per my experience, I have done custom work to log specific information.
2: send push notifications to android & ios client when offline: Again my experience is with custom solution as per Business needs. Custom code can be injected in your Openfire code and you can send http request to your push server (or You can send push directly to GCM or Apple by determining the platform of recipient). Custom code also provides you the ability to send as much information as you require. Like, You can send actual chat message in push, or if you want to send some customized message in push.
but i really dont know how to start: If you are willing to perform custom changes for your business needs, then hurry to checkout Openfire code from Github and set up development environment.
For Openfire Plugin Development, You can start with the plugin development guide: https://www.igniterealtime.org/builds/openfire/docs/latest/documentation/plugin-dev-guide.html
I'm developing an Android app that consumes a java webservice with REST API and make the DB(MySQL) persistence with Hibernate. Now, I want to add a chat on the application, but I don't really know how to start, if I use GCM or other options, so far it's working with threads that check for new messages every second. However, this seems very wrong as it consumes too much of the server. Is there a better solution, maybe a tutorial or just some tips on how to proceed?
From what I understand, this will be a two-way communication because it will be a chat app (server -> client, client -> server). In the case of using GCM, you will need to communicate via an XMPP library.
On the server side, an XMPP library should be able to register a packet listener that listens for incoming messages. Look at this implementation.
On the client side, you need to register a listener as well. The sample code should suffice to explain this.
I currently have an small application that I have been using to learn java/android programming. Right now I have a setup were the app on one phone sends a request (via sms) to another phone running the same app. The remote phone receives the request and sends back some info. Next I would like to try this from the web. Is there an established "best" way to to this?
I was thinking I would have a web server send requests to the device via google cloud messaging and then have the device return the data directly to the web server. (Not that I really know how to do any of that just yet).
I see that there is a google cloud messaging return path (send messages from the device to the google cloud server, but it seems very new, do I need something like that? The main thing I want is to be able to ask the phone to do something when I want, not have it poll to see if there is a request, or just periodically update some status.
UPDATE:
Thanks to the answers below for confirming to me that I was on the right track.
I now have some basic functionality.
I started out using this gcm android demo code
https://code.google.com/p/gcm/source/browse/#git%2Fgcm-client%2Fsrc%2Fcom%2Fgoogle%2Fandroid%2Fgcm%2Fdemo%2Fapp%253Fstate%253Dclosed
and this ruby gem
https://github.com/spacialdb/gcm/blob/master/README.md
between the above two I was able to send a message to my phone pretty easily.
To get the round trip working, I setup a very simple rails app on heroku.
I included a modified version of the sample code in the gcm gem in a controller and then used
HttpPatch (needed for rails 4) to send a post/patch from my phone to my web app, the controller then echoes the message back to my phone.
I guess it would be nice to get the two way gcm stuff to work, but I am not sure there are any gems that handle that, and I am not qualified to handle a task like that :)
I would say it's the right call: Google Cloud Messaging for Android
From the site Android Developer:
This could be a lightweight message telling your app there is new data
to be fetched from the server (for instance, a movie uploaded by a
friend), or it could be a message containing up to 4kb of payload data
(so apps like instant messaging can consume the message directly).
In this case you don't want to fetch data from the server but you want to send them.
You can send them in different ways. I would suggest, since you are learning, to try a RESTful solution using one of the implementation of JAX-RS.
As a short and direct answer for beginner : GCM (Google Cloud Messaging) would solve your issue. However, if your app turned out to be something bigger, other more technical and complicated solutions are present too.
see this link.
I am interested to make a chatbot. My script is currently working fine with imified.com bot. however imified is down almost everday. so i am looking for my own solution.
during my findings, I have found (through this site) openfire and I have configured it and it is working fine even with gmails users.
but i am still not getting what I need.
I need to request a URL (with the chat scripts and some other user data something like imified provides) when each gmail or other external users send me a message. let me explain.
my openfire is hosted and working for mybot.com and my id is: autobot#mybot.com.
now a gmail user say client#gmail.com added me in his gtalk/piding and we can communicate each other. he can send me message and I can reply.
but I need a robot instead of me. when client#gmail.com (and any other user) sends me a message, I need to request a URL so that i can dynamically generate response based on the message he/she sent.
in which way I should go for achieving this? Is there any way to customize openfire to do so?
or should I make a php/python (i need to learn python though) script that will listen to xmpp ports and generate responses? if so, any helpful scripts that may guide me?
bunch of thanks for reading it and thanks in advance for providing any response.
The OpenFire understand XMPP, what you need is XMPP library/API (like XMPP4R if you are Rubyist). Using it your app will login to OpenFire (by sending gmail/yahoo credentials) and others will see you as online. But when they will reply to you, you will be notified in your application. Where you can receive the message, process it, and send response (by writing a required program/logic).
We have done it in our SMS Chat application with Gmail/Yahoo messenger friends/contacts.
Openfire is XMPP-server. It's route messages between XMPP-clients.
You need XMPP-client which connects to server and process messages from other clients.
For example you can look here. That page contains two simple bots.
you can also use xmpp js lib 'strophe'
https://github.com/metajack/strophejs
and the xmpp python lib
https://github.com/fritzy/SleekXMPP
and the xmpp php lib
https://github.com/alexmace/Xmpp
have a try and good luck
You can try out our XMPP chat bot, it has been tested with openfire :
http://github.com/gbin/err
It is super easy to setup, and making a minimal hello world plugin is quite easy, no need to manipulate XMPP :
see https://gist.github.com/2902497