我怎么能在android中使用smack 4.2发送一个自定义的iq节呢?
我试着在smack iq中转换下一节,但没有成功
<iq type="set" to="[email protected]" from="[email protected]" id="modarchive-22317496CE4C">
<query
xmlns="urn:xmpp:mam:1" queryid="queryId-1FF4671B-183F-4CEA-BF84-CAAA5BA3293A"/> </iq>
我的smack代码
public IQ getCustomStanza(String group , String user){
IQ miQ= new IQ ("query") {
@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
return (IQChildElementXmlStringBuilder) xml.append ("<query xmlns= urn:xmpp:mam:1 queryid=queryId-1FF4671B-183F-4CEA-BF84-CAAA5BA3293A/>");
}
};
try {
miQ.setFrom (JidCreate.bareFrom (user));
miQ.setType (IQ.Type.set);
miQ.setTo (JidCreate.bareFrom (group));
miQ.setStanzaId ();
} catch (XmppStringprepException e) {
e.printStackTrace ( );
}
return miQ;
}
但是变空了
最佳答案
看看这家伙是如何构造他的class。尝试逆向工程以满足您的需求