powered by Jive Software

PingManager PingFailedListener not fired always in smack 4.2


I have used the PingManager to implement XMPP Ping in my android application

Sometimes I am not getting a ping from a server and not even my PingFailed listener is getting fired.

I am not able to identify the exact reason.

A ping is sent from the device and I did not receive any ping back from the server. And pingfailedlistener was not initiated in that case.

Then after the ping interval, another ping is sent from the client to the server and server did not respond again.

PingFailedListener was not called again. Then eventually a smack exception for time out was thrown. But this did not happen in the pingfailedlistener.The server was up. That was verified. Then I forcefully reconnected again.

The session was closed on the server but my connection.isConnected still returned true, and my client device was not able to identify the connection was closed on the server.

Device thinks its online while server shows offline.

Is it possible to check for outgoing and incoming ping packets to manually identify such cases where I can assume the connection is closed at the server if I did not get a ping back in an interval when the last ping was sent?

Can anyone please help me with this.

Thanks in Advance.

Here is my code.

mPingManager = PingManager.getInstanceFor(connection);

mPingManager.setPingInterval(pingInterval); //pingInterval was set to 1 min

mPingManager.registerPingFailedListener(new PingFailedListener(){


public void pingFailed() {

// TODO Auto-generated method stub

Log.e(“PING” , “ping failed”);