SDKsAndroid
Generate a conversation ID
Compute a conversation ID locally from the chat target and session type.
Compute a conversationID synchronously on the client from the target ID and session type without executing network queries.
Code example
String conversationID = OpenIMClient.getInstance().conversationManager
.getConversationIDBySessionType(
sourceId,
ConversationType.SINGLE_CHAT
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
sourceId | String | Yes | Target identifier. Pass the peer userID for direct chats or the groupID for group chats. |
sessionType | int | Yes | Conversation type: ConversationType.SINGLE_CHAT for direct chats; ConversationType.GROUP_CHAT or ConversationType.SUPER_GROUP_CHAT for group chats. |
Return value
Returns the computed conversationID string synchronously. This method is a pure local calculation that performs no network requests. To retrieve conversation metadata such as unread count, draft text, or latest message, call Get a conversation by target.
Was this page helpful?