User Profile Hosting Overview
This feature is supported starting from version 5.12.0.
Introduction to User Profile Hosting
Prior to version 5.12.0, IMKit's chat UI and conversation list only supported displaying user and group information through the User Info Provider Delegate method.
Starting with version 5.12.0, IMKit allows switching between user profile hosting methods to display user/group information in the chat UI and conversation list. It also introduces new profile hosting pages such as user profile pages, friend pages, and group profile pages.
After switching to profile hosting mode, user information will no longer be obtained via the info provider method. In the chat UI and conversation list, user information will prioritize data carried in message bodies, falling back to hosted information when unavailable.
Note: Conversation list information in IMKit is not updated in real-time. The latest information is fetched when entering the interface.
Enabling Profile Hosting
Before using this feature, you must activate the User Profile Hosting service in the Console.
By default, IMKit SDK uses the User Info Provider method to display user/group information in chat UIs and conversation lists. To switch to profile hosting mode:
RongUserInfoManager.getInstance().setDataSourceType(RongUserInfoManager.DataSourceType.INFO_MANAGEMENT);
After switching modes, user/group information displayed in conversation lists and chat UIs will be retrieved from the lib's profile hosting interface and cached in memory. Subsequent updates will maintain this in-memory cache. Only users with friend relationships or subscription relationships will trigger real-time updates in conversation lists and chat UIs.
The in-memory information remains valid throughout the application lifecycle.
To update user or group information, you must use the following RongCoreClient interfaces:
Updating Information
After switching to profile hosting mode, do not use refresh-related methods in RongUserInfoManager or lib interfaces with identical names. Instead, use these update methods:
Updating Current User Information
/**
* Update user profile
*
* <p>Note: It's recommended to fetch the latest user profile first before updating
*
* @param profile User profile information
* @param callback Operation result callback
* @since 5.16.0
*/
public abstract void updateMyUserProfile(
UserProfile profile, IRongCoreCallback.ExamineOperationCallback callback);
Updating Friend Information
/**
* Set friend information
*
* @param userId Friend's user ID
* @param remark Friend remark (max 64 chars, spaces-only not allowed). Pass null/empty to clear remark.
* @param extProfile Extended info (max 10 fields by default). Requires backend/API configuration first.
* @param callback Operation result callback
*/
public abstract void setFriendInfo(
final String userId,
final String remark,
final Map<String, String> extProfile,
final IRongCoreCallback.ExamineOperationCallback callback);
Updating Group Information
/**
* Update group profile
*
* <p>Group info edit permission groupInfoEditPermission {@link
* io.rong.imlib.model.GroupOperationPermission} determines whether group profile/permissions can be modified
*
* <p><strong>Notes:<br>
* Supported GroupInfo attributes:<br>
* 1. Group ID (id): max 64 chars (alphanumeric, case-sensitive)<br>
* 2. Group name (name): max 64 chars<br>
* 3. Group avatar (portraitUri): max 128 chars<br>
* 4. Group intro (introduction): max 512 chars<br>
* 5. Group notice (notice): max 1024 chars<br>
* 6. Extended info (extProfile): max 10 fields (requires backend/API configuration)<br>
* 7. Join permission mode (joinPermission)<br>
* 8. Member removal mode (removeMemberPermission)<br>
* 9. Invitation permission mode (invitePermission)<br>
* 10. Invitation handling mode (inviteHandlePermission)<br>
* 11. Group info edit mode (groupInfoEditPermission)<br>
* 12. Member info edit mode (memberInfoEditPermission)<br>
* Required fields: Group ID (id) and Group name (name)<br>
* See {@link io.rong.imlib.model.GroupInfo}<br>
*
* @param groupInfo Group information
* @param callback Operation result callback<br>
* Error handling:<br>
* - If errorData exists, it indicates the specific invalid GroupInfo key<br>
*/
public abstract void updateGroupInfo(
final GroupInfo groupInfo, final IRongCoreCallback.ExamineOperationCallback callback);
/**
* Set group remark
*
* @param groupId Group ID (regular groups only)
* @param remark Remark (max 64 chars, spaces-only not allowed). Null/empty removes remark. Last setting takes precedence.
* @param callback Operation result callback
*/
public abstract void setGroupRemark(
final String groupId,
final String remark,
final IRongCoreCallback.OperationCallback callback);
Updating Group Member Information
/**
* Set group member profile
*
* <p>Member info edit permission memberInfoEditPermission {@link
* io.rong.imlib.model.GroupMemberInfoEditPermission} determines whether member profiles can be modified
*
* @param groupId Group ID
* @param userId Member user ID
* @param nickname Member nickname (max 64 chars, spaces-only not allowed)
* @param extra Additional info (max 128 chars). Note: null means keeping current value.
* @param callback Operation result callback
*/
public abstract void setGroupMemberInfo(
final String groupId,
final String userId,
final String nickname,
final String extra,
final IRongCoreCallback.ExamineOperationCallback callback);
The in-memory information is primarily used for displaying basic user/group names, remarks, and avatars in SDK conversation lists and chat UIs, ensuring synchronization of these core attributes. For other information, we recommend using the lib-layer profile hosting interfaces directly for setting or retrieval.