javaandroidsmackasmack

how to map receiptid to sent message in smack


I am sending message using asmack from a client. I am sending message using xmppconnection.send and added this DeliveryReceiptManager.addDeliveryReceiptRequest(msg);

before sending. And on delivery of message i added a listner

DeliveryReceiptManager.getInstanceFor(connection).addReceiptReceivedListener(new ReceiptReceivedListener() {                    
@Override
public void onReceiptReceived(String arg0, String arg1, String arg2) {

in which i am getting receiptid,

I want to know how will i map this receiptid to the send message.


Solution

  • By adding the request and from the msg.getPacketId() i am getting the packet id, which i check on receipt.

                     DeliveryReceiptManager.addDeliveryReceiptRequest(msg);
                     System.out.println("packetid:"+msg.getPacketID());
    
                    connection.sendPacket(msg);