Hi guys,
I’m using Smack 4.1 for Android application. I want to using the ChatStateListener to detect typing status. But i got nothing in stateChanged. But when I try use other Xmpp app, it can detect typing status.
Here is my code
public class CustomMessageListener implements ChatMessageListener,ChatStateListener {
private Context context; public CustomMessageListener(Context context) {
this.context = context;
}
@Override
public void processMessage(Chat chat, Message message) {
Log.d("XMPP",message.toXML().toString());
if (message.getBody() != null) {
// do somthing
}
} @Override
public void stateChanged(Chat chat, ChatState state) {
Log.d("XMPP","chat state change : " + state.name());
if (ChatState.composing.equals(state)) {
Log.d("XMPP",chat.getParticipant() + " is typing.");
} else if (ChatState.gone.equals(state)) {
Log.d("XMPP",chat.getParticipant() + " has left the conversation.");
} else {
Log.d("XMPP",chat.getParticipant() + ": " + state.name());
}
}
}
And I always set the typing satus when message editor on changed. But why as I see the stateChanged never raise. Please help me.
Thanks