AI Integration Quick Reference
AI Integration Quick Reference
- Create Group
- Join Group
- View Members
- Add Member
- Ban Member
- Change Member Scope
- Transfer Ownership
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.
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(orConversationActivity) and an optionalGroupDetailsActivityin your flow.
Components
Integration Steps
1. Layout/UI Setup
Add a FAB to launch the group-management dialog.activity_messages.xml
2. Wiring UI in Activity
Initialize UIKit views and respond to FAB clicks.- Kotlin
- Java
MessagesActivity.kt
3. Create & Join Group
Allow users to create or join a group via Core SDK.- Kotlin
- Java
4. View Group Members
Fetch and display the current member list.- Kotlin
- Java
5. Add Member
Select users not in the group and add them.- Kotlin
- Java
GroupDetailsActivity.java
6. Ban Member, Change Scope & Transfer Ownership
Perform moderation actions on selected members.- Kotlin
- Java
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