开发者

Sending and Receiving IQ Packets ASMACK/SMACK Android XMPP

开发者 https://www.devze.com 2023-04-05 03:56 出处:网络
I would highly appreciate if someone can help me how to recieve iq packets with ASMACK, i am sending raw iq packets but not able to receive it,

I would highly appreciate if someone can help me how to recieve iq packets with ASMACK, i am sending raw iq packets but not able to receive it,

I have registered the iq packets programatically before making a connection but still not getting reponse,

     pm.addIQProvider("vCard", "vcard-temp", new VCardProvider());

  final IQ iq = new IQ() {
          public String getChildElementXML() {
            return "<iq from='test@XX.XX.XX.XX' id='v1'      to='test@XX.XX.XX.XX' type='get'><vCard xmlns=开发者_开发问答'vcard-temp'/></iq>";
          }
        };

    iq.setType(IQ.Type.GET);
        connection.sendPacket(iq);
        connection.addPacketListener(new MyPacketListener(),new       PacketTypeFilter(IQ.class));    


First of all, try setting your packet listener before you send the packet. It is an asynchronous protocol and it is possible that the response is being returned before your listener is setup to receive it.

Then try setting -DsmackDebugEnabled=true to check that there is an actual response to your send.


You can implement a Packet Listner method, the processPacket(Packet packet) method will give you the incoming packets. Here is a stack thread which explains the same issue aSmack - Packet to XML using Packet Listener outputs nullable elements

0

精彩评论

暂无评论...
验证码 换一张
取 消