android - How to know Typing Status in XMPP openfire using Smack -


i developing chat application using openfire xmpp server. can text chat between 2 user. want know typing status when 1 typing message. created class :-

public class typingstatus implements chatstatelistener {      @override     public void processmessage(chat arg0, message arg1) {         // todo auto-generated method stub      }      @override     public void statechanged(chat arg0, chatstate arg1) {         // todo auto-generated method stub         system.out.println(arg0.getparticipant() + " " + arg1.name());      }  } 

but confuse how work? know need packet can in listener. unable find packet.

please 1 suggest, how work?

and difference between smack , asmack?

thank you!

to enable chatstatelistener need create custom messagelistener class

public class messagelistenerimpl implements messagelistener,chatstatelistener  {      @override     public void processmessage(chat arg0, message arg1) {         system.out.println("received message: " + arg1);      }      @override     public void statechanged(chat arg0, chatstate arg1) {         if (chatstate.composing.equals(arg1)) {             log.d("chat state",arg0.getparticipant() + " typing..");         } else if (chatstate.gone.equals(arg1)) {             log.d("chat state",arg0.getparticipant() + " has left conversation.");         } else {             log.d("chat state",arg0.getparticipant() + ": " + arg1.name());         }      }  } 

then create messagelistener object

messagelistener messagelistener = new messagelistenerimpl(); 

and pass in create chat method

chat newchat = chatmanager.createchat(jabber_id_of_friend, messagelistener); 

what difference between smack , asmack? <-- check this


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -