Getting joined rooms through MultiUserChatManager

My use case:
I have joined some MUC rooms on device A. Later I have connected to the server from device B using smack based client. I would like to receive list of rooms I have joined so I could join from device B. Rooms can come from different conference services/domains.

Smack have (at least by looking at documentation) some nice methods that could help me with that, but it doesn’t work as I would except.

// Get the MultiUserChatManager 
MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);

// There is method for getting joined rooms
Set<EntityBareJid> joined1 = manager.getJoinedRooms()

// And there method to check what rooms joined users with specific JID which I am trying to use on own JID
List<EntityBareJid> joinedRooms = manager.getJoinedRooms(connection.getUser());

Both of the upper methods will return empty set/list of rooms. Are there other methods that woud be helpful in achieving my goal or I am doing something wrong? Perhaps I should/could write some logic around some other components (maybe ServiceDiscoveryManager) to achieve my goal?.

Used Smack version 4.3.3

EDIT:

So for others who would like to achieve the same: you can use Bookmark Manager in Smack to find rooms you are in.

1 Like

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.