【发布时间】:2015-06-01 21:56:39
【问题描述】:
我正在使用 XMPP(smack 4.1.1) 制作 android 聊天应用程序。 这是我使用的节数据包侦听器。
但是当我使用这个监听器时,我得到了 UnsupportedIQ 错误。 我怎么了?
connection.addAsyncStanzaListener(new StanzaListener() {
@Override
public void processPacket(Stanza p) throws SmackException.NotConnectedException {
if (p.getStanzaId().equals(getTokenId)) {
IQ iq = (IQ) p;
if (iq != null && iq.getType().equals(IQ.Type.result)) {
// here, I want to get xxxxxx value from <value xmlns='jabber:client'>xxxxxxx</value>
}
}
}, new StanzaFilter() {
@Override
public boolean accept(Stanza stanza) {
return true;
}
});
IQ tokenIQ = new IQ("query", "urn:tmp:token") {
@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
xml.rightAngleBracket();
return xml;
}
};
getTokenId = tokenIQ.getStanzaId();
try {
connection.sendStanza(tokenIQ);
} catch (SmackException.NotConnectedException e) {
e.printStackTrace();
}
【问题讨论】: