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


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 =; 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


List AllFetures = manager.getFeatures();

Below is features list which i retrived:,

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




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


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()






// Create Connection object of xmpp connection with configured detail

connection = new XMPPTCPConnection(configuration);

connection.addAsyncStanzaListener(new StanzaListener() {


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() + “]”);





connection.login(user, password);

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