powered by Jive Software

Push an Android client when the app is closed without GCM/FCM


My XMPP-Server (ejabberd) pushs an android client, when the user receives an offline message in the MAM storage, but I think it´s not a good way to this with GCM /FCM.


  • The android client (XMPPTCPConnection) is completly disconnected, when the app is closed.
  • Push Notifications (using FCM) are not delivered immediately, even the priority is set to ‘high’.
  • For each MAM-Message the client has first to login and loads the message (takes 3 - 4 sec.)

The goal is to receive the message immediately like in Telegram, Viber or WhatsApp.
I did some research and found possible solution proposals to do this with the Smack API.

@Flow posted some answers on StackOverflow that NO push notifications are needed.

I want to try it out how it works…

The idea to make it work is the following:

  1. Create a Service class which is started START_STICKY
  2. Create a ServerPingWithAlarmManager object in the Service class
  3. Listen on connectivity changes

I don´t know when the XMPPTCPConnection’s instantShutdown() is called. When the MAM message is loaded?
And how to “push” the client that a new MAM message is available? Maybe using a PubSub node?
Is it the right way to get the messages immediately?

Thanks in advance.