Skip to main content
Quick Reference for AI Agents & Developers
// Transfer ownership to another member (owner only)
CometChat.transferGroupOwnership("GUID", "NEW_OWNER_UID", 
    object : CallbackListener<String>() {
        override fun onSuccess(message: String) { }
        override fun onError(e: CometChatException) { }
    })
Important:
  • Only the current owner can transfer ownership
  • The new owner must be an existing group member
  • Original owner becomes a regular admin after transfer
  • Required before owner can leave the group
Available via: SDK | REST API | UI Kits
How do I transfer the ownership of a group if I am the owner? To transfer the ownership of any group, you must first be the owner of the group. If you are the owner, use the transferGroupOwnership() method provided by the CometChat class. This is useful because the owner is not allowed to leave the group. If you want to leave the group as the owner, you must first transfer your ownership to another member of the group, and only then can you leave.
String GUID = "cometchat-guid-1";
String UID = "cometchat-uid-2";

CometChat.transferGroupOwnership(GUID, UID, new CometChat.CallbackListener<String>() {
  @Override
  public void onSuccess(String s) {
    Log.e(TAG, "Transfer group ownership successful");
  }

  @Override
  public void onError(CometChatException e) {
    Log.e(TAG, "Transfer group ownership failed : " + e.getMessage());
  }

});

Best Practices

Transfer ownership only to trusted, active members who understand group management responsibilities. Consider their activity level and commitment.
Inform the new owner before transferring ownership so they’re prepared for the responsibility and understand their new role.
If you plan to leave the group, transfer ownership first. Owners cannot leave without transferring ownership or deleting the group.
Ensure the target member is an active participant (not banned or kicked) before attempting to transfer ownership.

Troubleshooting

Symptom: transferGroupOwnership() fails with “Not the owner” error.Cause: User is not the current owner of the group.Solution: Only the current owner can transfer ownership. Check group.getOwner() to verify ownership.
Symptom: Transfer fails with “User not found” or “Not a member” error.Cause: The target UID doesn’t exist or is not a member of the group.Solution: Verify the UID is correct and the user is an active member. Use retrieve-group-members to confirm membership.
Symptom: leaveGroup() fails when user is the owner.Cause: Owners must transfer ownership before leaving.Solution: Use transferGroupOwnership() first, then call leaveGroup(). Alternatively, use delete-group to remove the group entirely.

Next Steps