SDKsAndroid
Retrieve typing status
Use getInputState to retrieve a specified user’s current typing status in a conversation.
Query whether a specific user is currently typing in a conversation. The SDK returns a list of platform IDs where the user is actively typing, allowing you to calibrate the typing indicator when entering a chat or recovering from a network disconnection.
Code example
String conversationID = "si_user_a_user_b";
String userID = "user_b";
OpenIMClient.getInstance().conversationManager.getInputState(
new OnBase<List<Integer>>() {
@Override
public void onSuccess(List<Integer> platformIDs) {
boolean isTyping = platformIDs != null && !platformIDs.isEmpty();
// isTyping indicates whether the user is actively typing
}
@Override
public void onError(int code, String error) {
// Failed to query typing status
}
},
conversationID,
userID
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<List<Integer>> | Yes | Callback handler for the asynchronous request. |
conversationID | String | Yes | Globally unique ID of the target conversation. |
userID | String | Yes | User ID of the target user to check. |
Return value
Upon success, onSuccess returns a list of platform IDs (List<Integer>) where the user is currently typing.
- A non-empty list indicates the user is actively typing on at least one client device.
- An empty or
nulllist indicates the user is not actively typing.
For real-time typing indicators and listeners, see Update typing status.
Was this page helpful?