一键导入
cometchat-android-v5-placement
Where to put CometChat in your Android app — Activity, Fragment, BottomSheet, Dialog, Tab, or embedded patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Where to put CometChat in your Android app — Activity, Fragment, BottomSheet, Dialog, Tab, or embedded patterns.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Angular-specific integration patterns for CometChat UI Kit v5 (@cometchat/chat-uikit-angular@5) — standalone bootstrap with main.ts init-before-bootstrap, functional route guards (CanActivateFn), lazy standalone routes (loadComponent), NgZone correctness for SDK callbacks, OnPush change detection, and SSR/Angular-Universal considerations.
Framework-specific patterns for integrating CometChat React UI Kit v6 into Astro projects using React islands. Covers client:only rendering, island communication, CSS handling, and common pitfalls.
Shared rules for CometChat React UI Kit v6. Always loaded alongside framework + placement skills. Read this first.
Add features (calls, reactions, polls, file sharing, presence, etc.) to an already-integrated CometChat project. Routes to the right sub-flow based on feature type — default (already enabled), extension (API toggle), ai-feature (API toggle + OpenAI key), dashboard-only (third-party config), package-install (calls), or component-swap (rich text).
Localization (i18n) across all CometChat UI Kit families — React, React Native, Angular, Android (V5/V6), iOS, Flutter (V5/V6). Covers CometChatLocalize.init signature differences (positional vs object), bundled languages, custom-language registration, RTL support, fallback to English, and cross-family drift risks. Cross-family — applies wherever the agent is configuring CometChat localization.
Integration patterns for bare React Native CLI projects — pod install, Info.plist + AndroidManifest permissions, Apple privacy manifest, native module linking, Metro config.
| name | cometchat-android-v5-placement |
| description | Where to put CometChat in your Android app — Activity, Fragment, BottomSheet, Dialog, Tab, or embedded patterns. |
| license | MIT |
| compatibility | Android 7.0+; Java 8+; Kotlin 1.8+; com.cometchat:chat-uikit-android:5.x |
| metadata | {"author":"CometChat","version":"3.0.0","tags":"chat cometchat android placement activity fragment bottomsheet dialog tabs integration"} |
Ground truth:
com.cometchat:chat-uikit-android:5.x(legacy/maintenance-only) views +docs/ui-kit/android. Official docs: https://www.cometchat.com/docs/ui-kit/android/overview · Docs MCP:claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp(or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.
Companion skills:
cometchat-android-v5-corecovers init and login;cometchat-android-v5-componentsprovides the component catalog.
This skill teaches WHERE to put CometChat in an existing Android project. It covers six placement patterns: dedicated Activity, Fragment, BottomSheet, Dialog, Tab/ViewPager, and embedded view. Each pattern includes step-by-step instructions and code examples in both Java and Kotlin.
cometchat-android-v5-corecometchat-android-v5-componentscometchat-android-v5-theming| User intent | Recommended placement | Why |
|---|---|---|
| Messaging app | Dedicated Activity with bottom tabs | Full-screen chat experience |
| Marketplace | Chat button → new Activity | Separate context from product browsing |
| SaaS / dashboard | Fragment in existing Activity | Chat alongside other features |
| Social / community | ViewPager + BottomNav tabs | Multi-section messenger |
| Support / helpdesk | BottomSheet overlay | Non-intrusive, dismissible |
| Quick reply | Dialog | Lightweight, modal |
| Embedded widget | View in existing layout | Inline chat within a screen |
The simplest and most common pattern. A full-screen Activity for the message view.
MessagesActivity layout (activity_messages.xml):
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.cometchat.chatuikit.messageheader.CometChatMessageHeader
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<com.cometchat.chatuikit.messagelist.CometChatMessageList
android:id="@+id/messageList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<com.cometchat.chatuikit.messagecomposer.CometChatMessageComposer
android:id="@+id/composer"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
Java:
public class MessagesActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_messages);
CometChatMessageHeader header = findViewById(R.id.header);
CometChatMessageList messageList = findViewById(R.id.messageList);
CometChatMessageComposer composer = findViewById(R.id.composer);
String uid = getIntent().getStringExtra("uid");
String guid = getIntent().getStringExtra("guid");
if (uid != null) {
CometChat.getUser(uid, new CometChat.CallbackListener<User>() {
@Override
public void onSuccess(User user) {
header.setUser(user);
messageList.setUser(user);
composer.setUser(user);
}
@Override
public void onError(CometChatException e) { }
});
} else if (guid != null) {
CometChat.getGroup(guid, new CometChat.CallbackListener<Group>() {
@Override
public void onSuccess(Group group) {
header.setGroup(group);
messageList.setGroup(group);
composer.setGroup(group);
}
@Override
public void onError(CometChatException e) { }
});
}
header.setBackIconVisibility(View.VISIBLE);
header.setOnBackPress(() -> finish());
}
}
Kotlin:
class MessagesActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_messages)
val header = findViewById<CometChatMessageHeader>(R.id.header)
val messageList = findViewById<CometChatMessageList>(R.id.messageList)
val composer = findViewById<CometChatMessageComposer>(R.id.composer)
val uid = intent.getStringExtra("uid")
val guid = intent.getStringExtra("guid")
when {
uid != null -> CometChat.getUser(uid, object : CometChat.CallbackListener<User>() {
override fun onSuccess(user: User) {
header.setUser(user)
messageList.setUser(user)
composer.setUser(user)
}
override fun onError(e: CometChatException) { }
})
guid != null -> CometChat.getGroup(guid, object : CometChat.CallbackListener<Group>() {
override fun onSuccess(group: Group) {
header.setGroup(group)
messageList.setGroup(group)
composer.setGroup(group)
}
override fun onError(e: CometChatException) { }
})
}
header.setBackIconVisibility(View.VISIBLE)
header.setOnBackPress { finish() }
}
}
Embed chat in a Fragment within an existing Activity. Useful for SaaS apps or multi-pane layouts.
Java:
public class ChatFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_chat, container, false);
CometChatConversations conversations = view.findViewById(R.id.conversations);
conversations.setOnItemClick((v, position, conversation) -> {
// Navigate to messages — either replace fragment or start Activity
});
return view;
}
}
Kotlin:
class ChatFragment : Fragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
val view = inflater.inflate(R.layout.fragment_chat, container, false)
val conversations = view.findViewById<CometChatConversations>(R.id.conversations)
conversations.setOnItemClick { v, position, conversation ->
// Navigate to messages — either replace fragment or start Activity
}
return view
}
}
Show chat as a bottom sheet overlay. Good for support/helpdesk.
Java:
BottomSheetDialog bottomSheet = new BottomSheetDialog(this);
View view = getLayoutInflater().inflate(R.layout.bottom_sheet_chat, null);
CometChatMessageList messageList = view.findViewById(R.id.messageList);
CometChatMessageComposer composer = view.findViewById(R.id.composer);
messageList.setUser(user);
composer.setUser(user);
bottomSheet.setContentView(view);
bottomSheet.show();
Kotlin:
val bottomSheet = BottomSheetDialog(this)
val view = layoutInflater.inflate(R.layout.bottom_sheet_chat, null)
val messageList = view.findViewById<CometChatMessageList>(R.id.messageList)
val composer = view.findViewById<CometChatMessageComposer>(R.id.composer)
messageList.setUser(user)
composer.setUser(user)
bottomSheet.setContentView(view)
bottomSheet.show()
Full messenger with Conversations, Users, Groups, and Calls as tabs.
Java:
binding.bottomNavigationView.setOnItemSelectedListener(item -> {
Fragment fragment;
int id = item.getItemId();
if (id == R.id.nav_chats) {
fragment = new ChatsFragment(); // Contains CometChatConversations
} else if (id == R.id.nav_users) {
fragment = new UsersFragment(); // Contains CometChatUsers
} else if (id == R.id.nav_groups) {
fragment = new GroupsFragment(); // Contains CometChatGroups
} else if (id == R.id.nav_calls) {
fragment = new CallsFragment(); // Contains CometChatCallLogs
} else {
return false;
}
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_container, fragment)
.commit();
return true;
});
User or Group on message components. CometChatMessageList, CometChatMessageComposer, and CometChatMessageHeader require either setUser() or setGroup() — never both, never neither.User/Group object before setting it. Use CometChat.getUser(uid) or CometChat.getGroup(guid) — don't construct objects manually.CometChatMessageHeader. The method is setBackIconVisibility(). Default is GONE. Set to VISIBLE when the user needs to navigate back.AndroidManifest.xml. Every new Activity needs a manifest entry.