Browse SDKs · Android
SDKsAndroid

Resolve a conversation ID

Use getConversationIDBySessionType() to resolve an Android conversation ID from a chat target.

Copy

When only the conversation ID is needed, call getConversationIDBySessionType() rather than constructing it in application code.

String conversationID = OpenIMClient.getInstance().conversationManager
    .getConversationIDBySessionType(
        targetUserID,
        ConversationType.SINGLE_CHAT
    );

sourceId is the peer userID for a one-to-one chat and groupID for a group chat. Use the group conversation type that matches the target group.

This Android API synchronously returns a String conversationID. It does not return ConversationInfo or trigger a conversation listener. Use Open a conversation when profile data is required.