# 2. SDK Features

#### Login management <a href="#user-content-login-management" id="user-content-login-management"></a>

**Login**

* Used to login Tio chat by FQA Token

| Param    | Type   | Description |
| -------- | ------ | ----------- |
| tokenFQA | String | Token FQA   |

* When successful login, the SDK returns a model user information which leads to the `onSuccess()` callback. Handling login successfully here.
* When login fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.loginChatByToken(tokenFQA, new IFTechTioCallback<UserCurrResp>() {
            @Override
            public void onSuccess(UserCurrResp info) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**isLoggedIn**

* Used to determine whether to log in
* Returns the user's logged in status, `true` is logged in, `false` is not logged in

```
TioSdkManager.INSTANCE.isLoggedIn();
```

**Logout**

* Used to logout Tio chat
* When successful logout, the SDK returns a event which leads to the `onSuccess()` callback. Handling logout successfully here.
* When logout fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.logout(new IFTechTioCallback<Unit>() {
            @Override
            public void onSuccess(Unit info) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

#### Conversation management <a href="#user-content-conversation-management" id="user-content-conversation-management"></a>

**fetchServerSessions**

* Used to chat list synchronization from local or server

| Param      | Type    | Description                                                                   |
| ---------- | ------- | ----------------------------------------------------------------------------- |
| fetchLocal | Boolean | Mode fetch data: `true` when fetch from local, `false` when fetch from server |

* When successful fetch data, the SDK returns a list chat which leads to the `onSuccess()` callback. Handling fetch data successfully here.
* When fetch data fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.fetchServerSessions(fetchLocal, new IFTechTioCallback<ChatListResp>(){
            @Override
            public void onFinish() {

            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onSuccess(ChatListResp info) {
                
            }
        });
```

**deleteSession**

* Used to delete session chat

<table><thead><tr><th width="177.33333333333331">Param</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>sessionId</td><td>String</td><td>Id session chat</td></tr><tr><td>isDeleteChatRecord</td><td>Boolean</td><td>Mode delete session: <code>true</code> when delete session and delete chat history, <code>false</code> when delete session and without deleting chat history</td></tr></tbody></table>

* When successful delete, the SDK returns a event which leads to the `onSuccess()` callback. Handling delete successfully here.
* When delete fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.deleteSession(sessionId, isDeleteChatRecord, new IFTechTioCallback<Unit>() {
            @Override
            public void onSuccess(Unit event) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**complaintSession**

* Used to complaint about session chat

| Param     | Type   | Description     |
| --------- | ------ | --------------- |
| sessionId | String | Id session chat |

* When successful complaint, the SDK returns a event which leads to the `onSuccess()` callback. Handling complaint successfully here.
* When complaint fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.complaintSession(sessionId, new IFTechTioCallback<Unit>() {
            @Override
            public void onSuccess(Unit event) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**clearAllMessagesInSession**

* Used to delete chat history

| Param     | Type   | Description     |
| --------- | ------ | --------------- |
| sessionId | String | Id session chat |

* When successful delete, the SDK returns a model status which leads to the `onSuccess()` callback. Handling delete successfully here.
* When delete fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.clearAllMessagesInSession(sessionId, new IFTechTioCallback<String>() {
            @Override
            public void onSuccess(String status) {

            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**topSession**

* Used to pin/unpin session

| Param     | Type    | Description                                                           |
| --------- | ------- | --------------------------------------------------------------------- |
| sessionId | String  | Id session chat                                                       |
| enable    | Boolean | Mode pin session: `true` when pin session, `false` when unpin session |

* When successful pin/unpin, the SDK returns a model status which leads to the `onSuccess()` callback. Handling pin/unpin successfully here.
* When pin/unpin fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.topSession(sessionId, enable, new IFTechTioCallback<String>() {
            @Override
            public void onSuccess(String status) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**fetchSessionInfoWithSessionId**

* Used to send request get chat information

| Param     | Type   | Description     |
| --------- | ------ | --------------- |
| sessionId | String | Id session chat |

```
TioSdkManager.INSTANCE.fetchSessionInfoWithSessionId(sessionId);
```

* Handling history chat on chat callback `onGetChatInfo`.

**enterConversationWithSessionId**

* Used to send operation enter room

```
TioSdkManager.INSTANCE.enterConversationWithSessionId();
```

**leaveConversationWithSessionId**

* Used to send operation leave room

```
TioSdkManager.INSTANCE.leaveConversationWithSessionId();
```

**registerConversationCallback**

* Used to register callback chat list synchronization

```java
TioSdkManager.INSTANCE.registerConversationCallback(new IFTechTioSocketCallBack.TioConversationCallback() {
            @Override
            public void didSetAllData(@Nullable List<? extends ChatListResp.List> data) {
                
            }

            @Override
            public void didAddSession(int position, @NonNull ChatListResp.List data) {

            }

            @Override
            public void didDeleteSession(int position) {

            }

            @Override
            public void didChangeTotalUnreadCount(int totalUnread) {

            }

            @Override
            public void didUpdateItemWhenReceiveChange(int position, @NonNull ChatListResp.List data) {

            }
        });
```

#### Room management <a href="#user-content-room-management" id="user-content-room-management"></a>

**createRoomName**

* Used to create public room

<table><thead><tr><th width="528.3333333333333">Param</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>roomName</td><td>String</td><td>Room name</td></tr><tr><td>intro</td><td>String</td><td>Intro room</td></tr><tr><td>uidList</td><td>String</td><td>list uid members in room</td></tr></tbody></table>

* When successful create room, the SDK returns a model room response which leads to the `onSuccess()` callback. Handling created room data successfully here.
* When create room fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.createRoomName(roomName, intro, listUid, new IFTechTioCallback<CreateRoomResp>() {
            @Override
            public void onSuccess(CreateRoomResp info) {

            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**activeRoom**

* Used to active room after create room

| Param  | Type   | Description     |
| ------ | ------ | --------------- |
| roomId | String | Id room created |

* When successful active room, the SDK returns a model active response which leads to the `onSuccess()` callback. Handling active room data successfully here.
* When active room fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.activeRoom(roomId, new IFTechTioCallback<ActChatResp>() {
            @Override
            public void onSuccess(ActChatResp info) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**exitFromRoom**

* Used to leave room

| Param  | Type   | Description |
| ------ | ------ | ----------- |
| roomId | String | Id room     |

* When successful leave room, the SDK returns status which leads to the `onSuccess()` callback. Handling leave room successfully here.
* When leave room fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.exitFromRoom(roomId, new IFTechTioCallback<String>() {
            @Override
            public void onSuccess(String status) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**deleteRoom**

* Used to disband room

| Param  | Type   | Description |
| ------ | ------ | ----------- |
| roomId | String | Id room     |

* When successful delete room, the SDK returns a model delete response which leads to the `onSuccess()` callback. Handling delete room successfully here.
* When delete room fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.deleteRoom(roomId, new IFTechTioCallback<DelGroupResp>() {
            @Override
            public void onSuccess(DelGroupResp info) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**transferRoom**

* Used to transfer room

| Param  | Type   | Description     |
| ------ | ------ | --------------- |
| roomId | String | Id room created |
| toUser | String | Uid new owner   |

* When successful transfer room, the SDK returns a model change owner response which leads to the `onSuccess()` callback. Handling transfer room data successfully here.
* When transfer room fails, it will be processed at callback `onFail()`.

```java
        TioSdkManager.INSTANCE.transferRoom(roomId, toUser, new IFTechTioCallback<ChangeOwnerResp>() {
            @Override
            public void onSuccess(ChangeOwnerResp info) {

            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**answerMessageNotificationForUid**

* Used to setting do not disturb room

| Param  | Type    | Description                                                     |
| ------ | ------- | --------------------------------------------------------------- |
| roomId | String  | Id room created                                                 |
| enable | Boolean | Mode DND room: `true` when enable DND, `false` when disable DND |

* When successful setting DND, the SDK returns status which leads to the `onSuccess()` callback. Handling setting DND successfully here.
* When setting DND fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.answerMessageNotificationForUid(roomId, enable, new IFTechTioCallback<Object>() {
            @Override
            public void onSuccess(Object status) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**fetchRoomInfoWithRoomId**

* Used to get room information

| Param  | Type   | Description |
| ------ | ------ | ----------- |
| roomId | String | Id room     |

* When successful get information, the SDK returns a model information room response which leads to the `onSuccess()` callback. Handling get information successfully here.
* When get information fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.fetchRoomInfoWithRoomId(roomId, new IFTechTioCallback<RoomInfoResp>() {
            @Override
            public void onSuccess(RoomInfoResp info) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**fetchMembersInRoom**

* Used to get room's list member

| Param      | Type   | Description               |
| ---------- | ------ | ------------------------- |
| roomId     | String | Id room                   |
| searchKey  | String | Key search member in room |
| pageNumber | Int    | Page number list members  |

* When successful get list members, the SDK returns a list members in room response which leads to the `onSuccess()` callback. Handling get list members successfully here.
* When get list members fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.fetchMembersInRoom(roomId, searchKey, pageNumber, new IFTechTioCallback<RoomUserListResp>() {
            @Override
            public void onSuccess(RoomUserListResp listResp) {

            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**addUser**

* Used to invite new user into room

| Param   | Type   | Description                          |
| ------- | ------ | ------------------------------------ |
| roomId  | String | Id room                              |
| uidList | List   | list uid members want invite to room |

* When successful add member, the SDK returns status which leads to the `onSuccess()` callback. Handling add member successfully here.
* When add member fails, it will be processed at callback `onFail()`.

```java
 TioSdkManager.INSTANCE.addUser(roomId, listUid, new IFTechTioCallback<String>() {
            @Override
            public void onSuccess(String status) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**removeUser**

* Used to remove user from room

| Param   | Type   | Description                            |
| ------- | ------ | -------------------------------------- |
| roomId  | String | Id room                                |
| uidList | List   | list uid members want remove from room |

* When successful remove member, the SDK returns status which leads to the `onSuccess()` callback. Handling remove member successfully here.
* When remove member fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.removeUser(roomId, listUid, new IFTechTioCallback<String>() {
            @Override
            public void onSuccess(String status) {

            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**updateUserNick**

* Used to change user's nick name in room

| Param    | Type   | Description          |
| -------- | ------ | -------------------- |
| nickName | String | New user's nick name |
| roomId   | String | Id room              |

* When successful update nick name, the SDK returns status which leads to the `onSuccess()` callback. Handling update nick name successfully here.
* When update nick name fails, it will be processed at callback `onFail()`.

```java
        TioSdkManager.INSTANCE.updateUserNick(newNickName, roomId, new IFTechTioCallback<String>() {
            @Override
            public void onSuccess(String status) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**updateRoomName**

* Used to update room name

| Param   | Type   | Description     |
| ------- | ------ | --------------- |
| newName | String | New room's name |
| roomId  | String | Id room         |

* When successful update room name, the SDK returns status which leads to the `onSuccess()` callback. Handling update room name successfully here.
* When update room name fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.updateRoomName(newRoomName, roomId, new IFTechTioCallback<String>() {
            @Override
            public void onSuccess(String status) {

            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**updateRoomNotice**

* Used to update room notice

| Param     | Type   | Description       |
| --------- | ------ | ----------------- |
| newNotice | String | New room's notice |
| roomId    | String | Id room           |

* When successful update room notice, the SDK returns event which leads to the `onSuccess()` callback. Handling update room notice successfully here.
* When update room notice fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.updateRoomNotice(newRoomNotice, roomId, new IFTechTioCallback<Unit>() {
            @Override
            public void onSuccess(Unit event) {

            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**updateRoomIntro**

* Used to update room intro

| Param    | Type   | Description      |
| -------- | ------ | ---------------- |
| newIntro | String | New room's intro |
| roomId   | String | Id room          |

* When successful update room intro, the SDK returns event which leads to the `onSuccess()` callback. Handling update room intro successfully here.
* When update room intro fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.updateRoomIntro(newRoomIntro, roomId, new IFTechTioCallback<Unit>() {
            @Override
            public void onSuccess(Unit event) {

            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**fetchAllRooms**

* Used to get list public room
* When successful get list public room, the SDK returns a list public room which leads to the `onSuccess()` callback. Handling get list public room successfully here.
* When get list public room fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.fetchAllRooms(new IFTechTioCallback<List<RoomListResp>>() {
            @Override
            public void onSuccess(List<RoomListResp> info) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**forbiddenAllRoom**

* Used to forbidden all user in room

| Param     | Type          | Description                                                                             |
| --------- | ------------- | --------------------------------------------------------------------------------------- |
| roomId    | String        | Id room                                                                                 |
| operation | OperationCode | Operation forbidden: `OperationCode.ON` when mute, `OperationCode.OFF` when cancel mute |

* When successful forbidden user, the SDK returns a model forbidden response which leads to the `onSuccess()` callback. Handling forbidden user successfully here.
* When forbidden user fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.forbiddenAllRoom(roomId, operationCode, new IFTechTioCallback<ForbiddenResp>() {
            @Override
            public void onSuccess(ForbiddenResp info) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**forbiddenUser**

* Used to forbidden user in room

| Param         | Type          | Description                                                                                                                                 |
| ------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| modeForbidden | ForbiddenMode | Mode forbidden: `ForbiddenMode.USER_DURATION` when user duration ban, `ForbiddenMode.USER_LONGTIME` when The user is banned for a long time |
| duration      | Long          | User duration is required for muting operation. Unit: second                                                                                |
| uid           | String        | Uid member forbidden in room                                                                                                                |
| roomId        | String        | Id room                                                                                                                                     |
| operation     | OperationCode | Operation forbidden: `OperationCode.ON` when mute, `OperationCode.OFF` when cancel mute                                                     |

* When successful forbidden user, the SDK returns a model forbidden response which leads to the `onSuccess()` callback. Handling forbidden user successfully here.
* When forbidden user fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.forbiddenUser(forbiddenMode, 5L, uidForbidden, roomId, operationCode, new IFTechTioCallback<ForbiddenResp>() {
            @Override
            public void onSuccess(ForbiddenResp info) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**fetchForbiddenUserListInRoomId**

* Used to get list user was forbidden in room

| Param      | Type   | Description                             |
| ---------- | ------ | --------------------------------------- |
| roomId     | String | Id room                                 |
| searchKey  | String | Key search member was forbidden in room |
| pageNumber | Int    | Page number list member was forbidden   |

* When successful get list was forbidden, the SDK returns a model include list member was forbidden in room response which leads to the `onSuccess()` callback. Handling get list member was forbidden successfully here.
* When get list member was forbidden fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.fetchForbiddenUserListInRoomId(roomId, pageNumber, searchKey, new IFTechTioCallback<ForbiddenUserListResp>() {
            @Override
            public void onSuccess(ForbiddenUserListResp info) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**checkStatusForUser**

* Used to check status user in room

| Param  | Type   | Description        |
| ------ | ------ | ------------------ |
| uid    | String | Uid member in room |
| roomId | String | Id room            |

* When successful get status, the SDK returns a model status user in room response which leads to the `onSuccess()` callback. Handling get status successfully here.
* When get status fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.checkStatusForUser(uidMember, roomId, new IFTechTioCallback<ForbiddenFlagResp>() {
            @Override
            public void onSuccess(ForbiddenFlagResp info) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**updateJoiningPermissionForRoom**

* Used to modify apply new member in room

| Param  | Type    | Description                                                                             |
| ------ | ------- | --------------------------------------------------------------------------------------- |
| roomId | String  | Id room                                                                                 |
| enable | Boolean | Mode joining permission: `true` when enable permission, `false` when disable permission |

* When successful update, the SDK returns status which leads to the `onSuccess()` callback. Handling update successfully here.
* When update fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.updateJoiningPermissionForRoom(roomId, enable, new IFTechTioCallback<String>() {
            @Override
            public void onSuccess(String status) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**updateReviewingPermissionForRoom**

* Used to modify review before invite new member

| Param  | Type    | Description                                                                             |
| ------ | ------- | --------------------------------------------------------------------------------------- |
| roomId | String  | Id room                                                                                 |
| enable | Boolean | Mode joining permission: `true` when enable permission, `false` when disable permission |

* When successful update, the SDK returns event which leads to the `onSuccess()` callback. Handling update successfully here.
* When update fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.updateReviewingPermissionForRoom(roomId, enable, new IFTechTioCallback<Object>() {
            @Override
            public void onFinish() {

            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onSuccess(Object event) {
                
            }
        });
```

**updateAddingFriendPermissionInRoom**

* Used to modify invite friend into room

| Param  | Type    | Description                                                                             |
| ------ | ------- | --------------------------------------------------------------------------------------- |
| roomId | String  | Id room                                                                                 |
| enable | Boolean | Mode joining permission: `true` when enable permission, `false` when disable permission |

* When successful update, the SDK returns event which leads to the `onSuccess()` callback. Handling update successfully here.
* When update fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.updateAddingFriendPermissionInRoom(roomId, enable, new IFTechTioCallback<Object>() {
            @Override
            public void onFinish() {

            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onSuccess(Object event) {
                
            }
        });
```

**searchFriends**

* Used to get list of friends that can be invite to the room

| Param     | Type   | Description       |
| --------- | ------ | ----------------- |
| roomId    | String | Id room           |
| searchKey | String | Key search friend |

* When successful get list friend, the SDK returns a list of friends response which leads to the `onSuccess()` callback. Handling get list friend successfully here.
* When get list friend fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.searchFriends(roomId, searchKey, new IFTechTioCallback<ApplyGroupFdListResp>() {
            @Override
            public void onSuccess(ApplyGroupFdListResp info) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**fetchMessagesHistory**

* Used to get history chat in room

| Param    | Type   | Description                                                                         |
| -------- | ------ | ----------------------------------------------------------------------------------- |
| startMid | String | The starting message id. If `startMid = null` sdk will take from the latest message |

* Handling history chat on chat callback `onFetchMessagesHistory`.

```
TioSdkManager.INSTANCE.fetchMessagesHistory(startMid);
```

**registerTioLinkStatus**

* Used to register receive status connect

```java
TioSdkManager.INSTANCE.registerTioLinkStatus(new IFTechTioSocketCallBack.StateEvent() {
            @Override
            public void tioLinkConnecting() {
                
            }

            @Override
            public void tioLinkConnected() {

            }

            @Override
            public void tioLinkDisconnected() {

            }

            @Override
            public void tioLinkAlreadyConnect() {

            }

            @Override
            public void tioLinkTokenNull() {

            }

            @Override
            public void tioUnLogin() {

            }

            @Override
            public void tioImServerNull() {

            }
        });
```

**registerRoomCallback**

* Used to register receive event from room

```java
        TioSdkManager.INSTANCE.registerRoomCallback(new IFTechTioSocketCallBack.TioRoomCallback() {
            @Override
            public void didDeleteRoom() {
                
            }

            @Override
            public void didTransferredRoom() {

            }

            @Override
            public void didExitFromRoom() {

            }

            @Override
            public void didUpdateRoomInfo() {
            }

            @Override
            public void didKickedOut() {

            }

            @Override
            public void didRejoin() {

            }
        });
```

#### Chat management <a href="#user-content-chat-management" id="user-content-chat-management"></a>

**sendMessage**

* Used to send message into room

| Param   | Type   | Description     |
| ------- | ------ | --------------- |
| content | String | Content message |

* When successful send message the SDk returns `true`, opposite returns `false`

```
TioSdkManager.INSTANCE.sendMessage(content);
```

**revokeMessage**

* Used to revoke message in room

| Param     | Type   | Description        |
| --------- | ------ | ------------------ |
| sessionId | String | Session id         |
| mid       | String | Id message in room |

* When successful revoke message, the SDK returns a model status which leads to the `onSuccess()` callback. Handling revoke message successfully here.
* When revoke message fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.revokeMessage(sessionId, mid, new IFTechTioCallback<String>() {
            @Override
            public void onSuccess(String status) {
                
            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**deleteMessage**

* Used to delete message in room

| Param     | Type   | Description        |
| --------- | ------ | ------------------ |
| sessionId | String | Session id         |
| mid       | String | Id message in room |

* When successful delete message, the SDK returns a model status which leads to the `onSuccess()` callback. Handling delete message successfully here.
* When delete message fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.deleteMessage(sessionId, mid, new IFTechTioCallback<String>() {
@Override
public void onSuccess(String status) {

            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**reportMessage**

* Used to report message in room

| Param     | Type   | Description        |
| --------- | ------ | ------------------ |
| sessionId | String | Session id         |
| mid       | String | Id message in room |

* When successful report message, the SDK returns a model status which leads to the `onSuccess()` callback. Handling report message successfully here.
* When report message fails, it will be processed at callback `onFail()`.

```java
TioSdkManager.INSTANCE.reportMessage(sessionId, mid, new IFTechTioCallback<String>() {
@Override
public void onSuccess(String status) {

            }

            @Override
            public void onFail(@NonNull String error) {

            }

            @Override
            public void onFinish() {

            }
        });
```

**registerChatCallback**

* Used to register callback chat in room

```java
TioSdkManager.INSTANCE.registerChatCallback(new IFTechTioSocketCallBack.TioChatCallBack() {
            @Override
            public void onGetChatInfo(@NonNull WxChatItemInfoResp info) {
                
            }

            @Override
            public void onFetchMessagesHistory(@NonNull TioRoomMsgList info) {

            }

            @Override
            public void onRecvMessages(@NonNull TioMsg roomMsg) {

            }

            @Override
            public void didDeleteMessage(long midMsg) {

            }

            @Override
            public void didRevokeMessage(long midMsg) {

            }

            @Override
            public void deleteAllMessagesInSession() {

            }

            @Override
            public void didReadAllMessage() {

            }

            @Override
            public void onHandshake() {

            }
        });
```

#### detachTioSdk <a href="#user-content-detachtiosdk" id="user-content-detachtiosdk"></a>

* Used to unregister all callback and free up sdk resources

```java
TioSdkManager.INSTANCE.detachTioSdk();
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ftech.gitbook.io/tio-chat-sdk/android-tio-chat-sdk/2.-sdk-features.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
