Browse SDKs · Android
Platform
SDKsAndroid

Apply to join a group

Submit an application to join a group or enter directly based on verification settings using joinGroup().

Copy

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

ParameterTypeRequiredDescription
baseOnBase<String>YesCallback delivering the asynchronous operation result.
groupIDStringYesTarget group ID.
reqMsgStringNoOptional application greeting or reason message sent to administrators.
joinSourceintYesJoin source code: 2 for invitation, 3 for search, 4 for QR code scan.
exStringNoCustom 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

  1. Callback confirmation: The onSuccess callback 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.
  2. Direct join vs. application verification:
  3. Direct join: The user becomes a group member immediately. The SDK triggers OnGroupListener.onJoinedGroupAdded, delivering the new GroupInfo to merge into the joined groups list using groupID.
  4. Requires verification: The application is stored on the server awaiting owner or admin approval. Once approved, the client receives onJoinedGroupAdded.
  5. 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.