5

Implementing smack API and now trying to get the Chat status like whether the user is Composing, Paused, 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 user Is typing I am sending status like this:

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

The problem is stateChanged function never gets called instead the chatStatus packet like composing etc.. is received in processMessage function.

How can I receive it in stateChanged function ?

no one
  • 477
  • 6
  • 19

0 Answers0