I am working on a sms application. I am able to send a message from my application using the function sendMessage("subject" , "to");. I need to know how to receive the message sent from the other end. I need to get that data and display the data in textview in my application. How can i achive that. How can i achive that. Please guide me.
Thanks in aadvance.
this will help you:
PacketFilter filter = new MessageTypeFilter(Message.Type.chat);
// Listener for incoming message from any user
connection.addPacketListener(new PacketListener() {
public void processPacket(Packet packet) {
final Message message = (Message) packet;
if (message.getBody() != null) {
fromName = StringUtils.parseBareAddress(message
.getFrom());
Log.i("XMPPClient", "Got text [" + message.getBody()
+ "] from [" + fromName + "]");
}
}
});
}
}
}, filter);