ChatStateListener is not working

Implementation of smack API and now an attempt to get chat status as a Composing , Paused user, etc. What i have done so far

 public class IncomingChatListener implements ChatMessageListener, ChatStateListener { @Override public void stateChanged(Chat chat, ChatState state) { Log.d("-----","into chat state"); if (ChatState.composing.equals(state)) { Log.d("Chat State",chat.getParticipant() + " is typing.."); } else if (ChatState.gone.equals(state)) { Log.d("Chat State",chat.getParticipant() + " has left the conversation."); } else { Log.d("Chat State",chat.getParticipant() + ": " + state.name()); } } public void processMessage(Chat chat, Message message) { ....... ...... } 

When the user types, I send the status as follows:

 ChatStateManager.getInstance(connection).setCurrentState(ChatState.composing, myChat); 

The problem is that the stateChanged function stateChanged never called, and the chatStatus package, such as layout, etc., is received in the processMessage function.

How can I get it in stateChanged function?

+5
source share

All Articles