I am using aSmack. My application listens for chat and responds to messages, but never sends a message. The application does not receive more messages if the chat remains in silence for a while, and then a new message is sent. I researched and I think that here is XEP-0199 . I see that @Flow (current supporting Smack) implemented it and the related problem was closed.
I think I need to use PingProvider, but I really don't know how to connect this class to Connection.
How to enable XEP-0199 ? How can i use PingProvider?
Connection Code:
smack = SmackAndroid.init(getActivity().getApplicationContext());
connection = new XMPPConnection(App.getServer());
connection.addConnectionListener(new ConnectionListener() {
private final static String SMACK = "SMACK";
@Override
public void reconnectionSuccessful() {
Log.i(SMACK , "reconnectionSuccessful");
}
@Override
public void reconnectionFailed(Exception e) {
Log.i(SMACK, "reconnectionFailed", e);
}
@Override
public void reconnectingIn(int seconds) {
Log.i(SMACK, "reconnectingIn " + seconds);
}
@Override
public void connectionClosedOnError(Exception e) {
Log.i(SMACK, "connectionClosedOnError", e);
}
@Override
public void connectionClosed() {
Log.i(SMACK, "connectionClosed");
}
});
connection.connect();
connection.login(user, password);