SDKsAndroid
Apply to join a group
Submit an application to join a group or enter directly based on verification settings using joinGroup().
Submit a request to join a specified group. Depending on the group's verification mode, this operation either adds the user immediately or forwards an application to group administrators for approval.
Code example
String groupID = "group_123";
String reqMsg = "Requesting to join the developer group";
int joinSource = 3; // 3 indicates joining via search
String ex = "{\"source\":\"search_page\"}";
OpenIMClient.getInstance().groupManager.joinGroup(
new OnBase<String>() {
@Override
public void onSuccess(String data) {
// Join request processed or application submitted successfully
}
@Override
public void onError(int code, String error) {
// Handle failure
}
},
groupID,
reqMsg,
joinSource,
ex
);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<String> | Yes | Callback delivering the asynchronous operation result. |
groupID | String | Yes | Target group ID. |
reqMsg | String | No | Optional application greeting or reason message sent to administrators. |
joinSource | int | Yes | Join source code: 2 for invitation, 3 for search, 4 for QR code scan. |
ex | String | No | Custom metadata string attached to the request (such as a JSON string). Pass "" if not needed. |
Return value
Upon success, data in onSuccess returns a confirmation message.
State changes after the call
- Callback confirmation: The
onSuccesscallback confirms that the request was accepted and processed by the server. The group's configured policy in Set group join verification determines the subsequent lifecycle. - Direct join vs. application verification:
- Direct join: The user becomes a group member immediately. The SDK triggers
OnGroupListener.onJoinedGroupAdded, delivering the newGroupInfoto merge into the joined groups list usinggroupID. - Requires verification: The application is stored on the server awaiting owner or admin approval. Once approved, the client receives
onJoinedGroupAdded. - Re-query calibration: To verify current group membership or refresh joined groups, call Check group membership or Get joined groups.
For complete listener registration details, see Group overview.
Was this page helpful?