Typing Status
The IMLib SDK can send the current user's typing status to ultra groups. Users who receive the notification in the ultra group can display "xxx is typing" in the UI.
tip
For optimal experience, it is recommended to use this feature only in ultra groups with fewer than 10,000 members.
Sending Typing Status
You can call sendUltraGroupTypingStatus when the current user is entering text to send the current user's typing status.
Interface
enum UltraGroupTypingStatus{
//Entering text
UltraGroupTypingStatusText = 0
}
class OperationCallback {
onSuccess()
onError(ErrorCode code)
}
public void sendUltraGroupTypingStatus(final String targetId, final String channelId, final IRongCoreEnum.UltraGroupTypingStatus typingStatus, final IRongCoreCallback.OperationCallback callback)
Parameter Description
| Parameter | Type | Description |
|---|---|---|
| targetId | String | Target ID of the ultra group conversation. |
| channelId | String | Channel ID of the ultra group. |
| status | UltraGroupTypingStatus | Typing status type. |
| callback | IRongCoreCallback.OperationCallback | Callback interface |
Listening for Typing Status
To reduce pressure on the server and client, the server aggregates user typing events over a period of time (e.g., 5 seconds) and delivers them in batches. Therefore, the callback is provided in the form of an array. When the application receives the notification, it can display "xxx is typing" in the UI.
class UltraGroupTypingStatusInfo {
String targetId
String channelId
String userId
UltraGroupTypingStatus status
long timestamp //The upstream time when the server received the user's action.
}
interface UltraGroupTypingStatusListener {
void onUltraGroupTypingStatusChanged(List<UltraGroupTypingStatusInfo> infoList);
}
public void setUltraGroupTypingStatusListener(IRongCoreListener.UltraGroupTypingStatusListener listener)