Android kit for cat placeholders :cat:



DeliveryReceiptManager Smack 4.1.+

Hi, in this topic we are going to discuss about delivery manager,

So what is a delivery manager?

DeliveryReceiptManager is user to get the delivery result of messages
that we send to the recipient is delivered or not.
DeliveryReceiptManager is Manager for XEP-0184: Message Delivery Receipts.
This class implements the manager for DeliveryReceipt support, 
enabling and disabling of automatic DeliveryReceipt transmission.(more) 

Let go to the coding part first we need to add the extension of
DeliveryReceipt using ProviderManager (Manages providers for parsing custom XML sub-documents of XMPP packets)

ProviderManager.addExtensionProvider(DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE, new DeliveryReceipt.Provider());
ProviderManager.addExtensionProvider(DeliveryReceiptRequest.ELEMENT, new DeliveryReceiptRequest().getNamespace(), new DeliveryReceiptRequest.Provider());


after that register a delivery receiver

 DeliveryReceiptManager.getInstanceFor(connection).addReceiptReceivedListener(new ReceiptReceivedListener() {
                public void onReceiptReceived(String fromJid, String toJid, String receiptId, Stanza receipt) {
                    Log.d(TAG, fromJid);
                    Log.d(TAG, toJid);
                    Log.d(TAG, "PACKED GOT--"+receiptId); 

Continue reading “DeliveryReceiptManager Smack 4.1.+”