AnsweredAssumed Answered

Cannot receive message using Smack

Question asked by Accelor on Dec 1, 2014
Latest reply on Apr 25, 2017 by Aayush Thakur

Hello!

 

I am trying to develop a chat application for android and iOS in which I am using OpenFire as the chat server. OpenFire has already been setup on AWS. But I am facing a problem here. I cannot receive messages using Smack.

 

 

Also I need to know that if I receive messages using Smack then does it retrieves all messages in one go or it sends the latest message, when this receive API is called.

 

 

----------------------------------------------

       I am using this to get messages function not returning message list,

 

 

i am able to send message to server but cant receive message list.

         

 

 

         ChatManager chatmanager = con.getChatManager();

Chat newChat = chatmanager.createChat("user4@jmj-pc",null);

newChat.addMessageListener(new MessageListener() {

                @Override

  public void processMessage(Chat chat, Message message) {

  System.out.println("Received message: " +message.getBody());

  }

  });

 

 

 

 

try {

    newChat.sendMessage("message body, jmj!");

}

catch (XMPPException e) {

    System.out.println("Error Delivering block");

}

 

 

 

 

----------------------------------------------

Outcomes