Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XMPP (Openfire) Push Notifications Android

I really tried to find a solution to this problem but didn't. There are some threads related to this concept, but I didn't find a comprehensive solution.

I have a server with Openfire which sends messages. When both users are online, there is no problem. However, when a user is offline I would like to send a push notification, as in Whatsapp. I heard that Whatsapp and other IM apps use a modified version of ejabber to send push notifications, but couldn't find out how.

One possibility is to use GCM, but I am not sure if this is the right way to go. Also I would like to avoid polling, for the sake of not draining battery life.

Does anyone know some solution to this or has an example?

like image 702
Max Avatar asked Jun 01 '13 13:06

Max


2 Answers

I am studying the openfire and found some good options that I would like to share with you. I found a plugin in github and i will test it this week. It seems that will be a good solution to your goal and to my: https://github.com/meisterfuu/Openfire-GCM/

Another option is to use CallbackOnOffline Plugin that calls a specified URL with To and From parameters. This url could be a endpoint in your web service, and with that data (To and From) you could get the associated Id for push in your base, and did a push.

https://www.igniterealtime.org/projects/openfire/plugins.jsp

like image 171
Lucas Ferraz Avatar answered Oct 11 '22 09:10

Lucas Ferraz


Well, you could use GCM with XMPP. The new GCM Cloud Connection Server allows you to use the XMPP protocol for a bidirectional (Cloud to Device and Device to Cloud) communication between your server and your Android application.

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.

like image 2
Eran Avatar answered Oct 11 '22 07:10

Eran