I solved my problem but not sure it is the best approach. However, hope this will help you guys and always welcome for better answer.
I first addInvitationListener and automatically join room once receive any invitation
MultiUserChat.addInvitationListener(connection, new InvitationListener() {
@Override
public void invitationReceived(Connection conn, String room, String inviter, String reason, String password, Message arg5) {
MultiUserChat muc = new MultiUserChat(connection, room);
try {
muc.join(connection.getUser().substring(0, connection.getUser().indexOf("@")));
} catch (XMPPException e) {
Log.d("Error","line 123 : "+e.toString());
}
muc.addMessageListener(new ServiceGroupMessageListener(getApplicationContext()));
}
});
Next, i store all the entered room name into Database. Then create a function that would grab the room name from database and finally add message listener to each of the room. So that when next time i open the app again, it will have message listener bind to each chat room.
***make sure change room setting to persistent at openfire side