1
votes

I am not able to receive XMPP messages, I am using the following code:

    Message mess = new Message() {
           @Override
           public String toXML() {
           return "<message to='[email protected]' id='message22'><body>Great    Mesg</body><x xmlns='jabber:x:event'><offline/><delivered/><composing/></x></message>";
          }
    };


    PacketFilter filter = new MessageTypeFilter(Message.Type.chat);
    connection.sendPacket(mess);
    connection.addPacketListener(new PacketListener() {
            public void processPacket(Packet packet) {
              Message message = (Message) packet;
              Log.d("Recv", "Message: " + message.toXML());
          }
    }, filter);

Basically I am using patched version of SMACK for android....and trying to get message states using xep 0022.

1
What exactly is going wrong? Give a more detailed description of the problem. Also, you've only accepted answers to 17% of the questions you've asked. If you didn't get any good answers, then that's OK, but you might like to review questions you've asked in the past and click the check mark/tick next to the best answer, if there are good answers. This encourages people to answer your future questions.Jon Bright
The question werent answered the right way..so that was a problem...in this quesiton i m not recieving the message on console, in debug mode i can see the message comming, but smack is not listing to message. plz guide me...Programmer

1 Answers

1
votes

I think your filter is the cause of your problem. If your incoming messages do not have the type='chat' attribute defined, then they will be of type Message.Type.normal. I am only guessing of course since you did not post the incoming message, but the one you send does not include a type.

You may want just create a ChatManagerListener and register it with the ChatManager instead. This will then handle this case.

Note: You are aware that XEP-0022 is obsolete right?