Offline message not retrive from smack api 4.1.6 from xmpp MongooseIM server

Hello

I am facing the issue to retrieve offline message in android apps using smack api from XMPP Mongoose server. As per the code flow Try to retrive offline message when user become login in xmpp mongoose server before sending available presence to mongoose server.

Tried with two different way to retrieve offline message still not able to find working solution for the same. Both method which i tried those all things are explain below with detail.

Below Api we are using for the xmpp connection and all other extension :

// Smack (XMPP Client Library)

compile ‘org.igniterealtime.smack:smack-android:4.1.6’

compile ‘org.igniterealtime.smack:smack-tcp:4.1.6’

compile ‘org.igniterealtime.smack:smack-im:4.1.6’

compile ‘org.igniterealtime.smack:smack-android-extensions:4.1.6’

Tried retrive offline message Using offlineMessageManager

Below is code which I tried to retrieve offline message after login and before send available presence to server

try {

Boolean isFelxibleRetrievalSupport = offlineMessageManager.supportsFlexibleRetrieval();

Iterator i = (Iterator) offlineMessageManager.getMessages();

while (i.hasNext())

{ Message msg = i.next(); System.out.println(“Got text [” + msg.getBody() + “] from [” + msg.getFrom() + “]”); }

} catch (XMPPException e)

{ System.out.println(“Error Offline Message.”); e.printStackTrace(); }

catch (SmackException.NotConnectedException e)

{ System.out.println(“Error Offline Message. No connection”); e.printStackTrace(); }

catch (SmackException.NoResponseException e)

{ System.out.println(“Error Offline Message. No Reponse”); e.printStackTrace(); }

Issue case 1:

Below is exception detail which generate when above code execute

I got Exception when execute below line of code.

Iterator i = (Iterator) offlineMessageManager.getMessages();

Below is exception description which Generate when above line execute

org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: service-unavailable - cancel

Issue Case 2:

If checking is Flexible offline message supported from android code using smack from xmmp mongoose server so i got false value. Below is code which i used for testing.

Boolean isFelxibleRetrievalSupport = offlineMessageManager.supportsFlexibleRetrieval();

Issue Case 3:

When I try to retrieve supported features using below method using smack code like below.

ServiceDiscoveryManager manager = ServiceDiscoveryManager

.getInstanceFor(connection);

List AllFetures = manager.getFeatures();

Below is features list which i retrived:

http://jabber.org/protocol/bytestreams,

jabber:iq:privacy, urn:xmpp:ping,

http://jabber.org/protocol/commands,

jabber:iq:version,

jabber:iq:last,

http://jabber.org/protocol/xdata-validate,

http://jabber.org/protocol/xhtml-im,

vcard-temp,

http://jabber.org/protocol/chatstates,

urn:xmpp:receipts, urn:xmpp:time,

http://jabber.org/protocol/xdata-layout,

http://jabber.org/protocol/muc,

http://jabber.org/protocol/disco#items,

http://jabber.org/protocol/disco#info,

http://jabber.org/protocol/caps,

jabber:x:data

Tried to retreive offline message Using package listener from XMPP MongooseIM

below is code which i tried using package listener from smack api 4.1.6.

private static final StanzaFilter MESSAGE_PACKET_FILTER= new OrFilter(StanzaTypeFilter.MESSAGE);

configuration = XMPPTCPConnectionConfiguration.builder()

.setServiceName(SERVICE_NAME)

.setHost(KDevelopmentXMPPServer)

.setPort(PORT)

.setSendPresence(false)

.build();

// Create Connection object of xmpp connection with configured detail

connection = new XMPPTCPConnection(configuration);

connection.addAsyncStanzaListener(new StanzaListener() {

@Override

public void processPacket(Stanza packet) throws SmackException.NotConnectedException {

Log.d(“CheckPacket”, “OfflineMEssage”);

Message message = (Message) packet;

if (message != null) {

if (message.getBody() != null) {

Log.i(“XMPPClient”, “Got text [” + message.getBody()

  • “] from [” + message.getFrom() + “]”);

}

}

}

}, MESSAGE_PACKET_FILTER);

connection.login(user, password);

Thanks In Advance, Please anybody help me for best working solution for my critical issue.