How to know Typing Status in XMPP openfire using Smack

后端 未结 8 1835
既然无缘
既然无缘 2020-11-30 01:42

I am developing chat application by using Openfire XMPP server. I can text chat between two user. But i want to know Typing status when some one is typing message. So i crea

8条回答
  •  执念已碎
    2020-11-30 02:13

    However you can get it from ProcessPacket also. there you will get a Message object, after you can extract xml portion from there and handle them its contain specific chatstate or not.

        Message message = (Message) packet;
        String msg_xml = message.toXML().toString();
    
        if (msg_xml.contains(ChatState.composing.toString())) {
            //handle is-typing, probably some indication on screen
        } else if (msg_xml.contains(ChatState.paused.toString())) {
            // handle "stopped typing"
        } else {
           // normal msg
        }
    

    now handle as per your requirement.

提交回复
热议问题