powered by Jive Software

Asmack 4.0 , I can't get offline message

some code:

OfflineMessageManager offlineManager = new OfflineMessageManager(


int count = offlineManager.getMessageCount());

List messages = offlineManager.getMessages();

the count=3,but messages is[]. why?

can anyone help one

config.setSendPresence(false) before U login,otherwise U will not get offline message

1 Like

thanks for your answer,but i had add the method(config.setSendPresence(false) ) before i login, i can’t still get offline messgae !the message count i can get,but the messages list is empty! i can’t understand. my english is poor,don’t care!

//Can’t get offline messages for asmack4.0.2


// The method can get offline messages now,messageCollector must be created before send packet,the problem is wrong code order


public List getMessages() throws NoResponseException, XMPPErrorException, NotConnectedException {

List messages = new ArrayList();

OfflineMessageRequest request = new OfflineMessageRequest();


PacketCollector messageCollector = connection.createPacketCollector(packetFilter);//before


// Collect the received offline messages

Message message = (Message) messageCollector.nextResult();

while (message != null) {


message = (Message) messageCollector.nextResult();


// Stop queuing offline messages


return messages;


Reported as SMACK-589 and fixed in latest 4.0.3 SNAPSHOTS.