powered by Jive Software

Can't get history when joining multiple rooms

I have an Android application which uses the asmack library to connect to my OpenFire server.

In this application I have code to join a MultiUserChat room and it works. On one screen I join 1 room with no problems. But on an another screen there is a problem. On this second screen I join to the same room plus another room. (for two tabs in my tabhost)

In the first screen I get my chat history correctly as expected. However in the second screen I don’t get the old messages. When I go back to the previous screen I receive the old messages as I expected.

So in second screen I do something like:

room1.join(…);

room1.addNewMessageListener(…);

room2.join(…);

room2.addNewMessageListener(…);

Both screens use the same code to join the rooms. When in the second screen I remove the line to join the second room, it works.
When I send a new message, while I joined 2 rooms, It comes into the PacketListener and receives the new message. So it can show it in the ListView. But I also want the old ones…

Also I have the following code to specify I want the history:

DiscussionHistory history = new DiscussionHistory();

history.setMaxStanzas(Integer.MAX_VALUE);

chat.join(user.getNickname(),"", history, SmackConfiguration.getPacketReplyTimeout());

I checked my OpenFire server settings and the history/chat logs are stored. But since it works when I join only 1 room, the problem lies at client side.

Why is this and how to solve the problem? If more information/code is needed please ask.