Skip to main content
Enable seven core group-management features in your Android app using CometChat UIKit v5:
  • Create Group
  • Join Group
  • View Members
  • Add Member
  • Ban Member
  • Change Member Scope
  • Transfer Ownership
These moderation tools transform a static chat into a dynamic, manageable experience, all accessible via a clean UI.

Overview

A user can create or join a group, then open a dialog to:
  • View current members.
  • Add or ban participants.
  • Change member roles (e.g., member, moderator).
  • Delegate group ownership.
Typically, a FloatingActionButton (FAB) or menu item launches the group-management dialog, which uses CometChat Core SDK calls under the hood.

Prerequisites

  • Android Studio project with cometchat/cometchat-uikit-android and cometchat/chat-sdk-android in build.gradle.
  • Internet permission in AndroidManifest.xml.
  • Valid CometChat App ID, Region, and Auth Key configured via UIKitSettings.
  • User logged in with CometChatUIKit.login().
  • A MessagesActivity (or ConversationActivity) and an optional GroupDetailsActivity in your flow.

Components

Integration Steps

1. Layout/UI Setup

Add a FAB to launch the group-management dialog.
File reference:
activity_messages.xml

2. Wiring UI in Activity

Initialize UIKit views and respond to FAB clicks.
MessagesActivity.kt

3. Create & Join Group

Allow users to create or join a group via Core SDK.

4. View Group Members

Fetch and display the current member list.

5. Add Member

Select users not in the group and add them.
File reference:
GroupDetailsActivity.java

6. Ban Member, Change Scope & Transfer Ownership

Perform moderation actions on selected members.

Implementation Flow Summary

Customization Options

  • Use a BottomSheetDialog instead of a standard dialog.
  • Implement multi-select for bulk actions (e.g., add multiple members).
  • Replace default dialogs with custom RecyclerView lists.
  • Control permissions: show options only to admins or owners.

Error Handling & Edge Cases

  • Not in Group: Disable join option if user is already member.
  • Permission Denied: Only show ban/transfer options to group admins.
  • Empty Lists: Display an empty-state view if no members or users.
  • Pagination: Implement fetchNext() in scroll listeners for large groups.

Feature Matrix

Android Sample App (Java)

Explore this feature in the CometChat SampleApp: GitHub → SampleApp

Android Sample App (Kotlin)

Explore this feature in the CometChat SampleApp: GitHub → SampleApp