Stream Chat Android SDK

repository·develop·Indexed 23 days ago

https://github.com/getstream/stream-chat-android

SDK for building chat and messaging experiences on Android. It provides a low-level Client SDK for API communication and event handling, alongside high-level UI SDKs for both Jetpack Compose and XML-based layouts. Key features include channel and message lists, reactions, typing/read indicators, attachments, threads, push notifications, and offline support via local caching.

Tokens
17.6K
Snippets
35
Records
68
Agent score
81%

What's inside stream-chat-android

  1. Overview of Stream Chat Android SDK

    develop

    The Stream Chat Android SDK is a service for building chat and messaging applications. It provides two main layers of functionality:

    1. Low-level Client SDK: Used for making API calls and receiving chat events.
    2. UI SDKs: Reusable components for building the chat interface.

    UI Options

    • Compose UI Components: Modular, reusable Composables designed for Jetpack Compose. This is the recommended approach for modern Android applications.
    • XML UI Components: Customizable chat Views for projects using traditional XML-based layouts.

    Key Features

    • Channels list and Channel UI
    • Message reactions, editing, and deleting
    • Typing and Read indicators
    • Attachments (Image, Video, File), GIF support, and Link previews
    • Threads, Slash commands, and Markdown formatting
    • Push notifications and Unread message counts
    • Light and Dark themes with style/UI customization
  2. Supported features in Stream Chat Compose UI

    develop

    The Compose UI Components sample app demonstrates the following out-of-the-box features supported by the SDK:

    • Messaging Core: Message list UI, Channel list UI, Threads and replies, Editing and deleting messages, Markdown message formatting.
    • Interactions: Message reactions, Typing indicators, Read indicators, Link previews.
    • Media & Attachments: Attachments picker, Image gallery.
    • System & UI: Offline support, Push notifications, Unread message counts, Light and dark themes, Style customization.
  3. Use Stream Chat Android Compose UI Components

    develop

    The stream-chat-android-compose module provides reusable UI components specifically built for Jetpack Compose. If your project uses traditional XML layouts instead of Compose, you should use the stream-chat-android-ui-components library instead.

    For detailed documentation on how to use these components, refer to the Compose UI Components documentation.

  4. Use the Stream Chat Android Client SDK

    develop

    The stream-chat-android-client module is the official low-level Android SDK for Stream Chat. It provides direct integration with Stream Chat APIs.

    Note: This is a low-level client library. It does not include state handling or UI components. For high-level features including UI and state management, refer to the main Stream Chat Android SDK documentation.

  5. Supported features in the UI Components SDK

    develop

    The UI components library provides out-of-the-box support for the following chat features:

    • Messaging Core: Message list UI, Message reactions, Editing and deleting messages, Markdown message formatting, and Unread message counts.
    • Channel Management: Channel list UI, Threads and replies, and Channel details.
    • Rich Media & Interaction: Link previews, Attachments picker, Image gallery, and Typing/Read indicators.
    • System & UX: Offline support, Push notifications, Light and dark themes, and Style customization.
  6. Explore Stream Chat Android UI Components

    develop

    The UI components module provides a variety of pre-built views and screens for building chat interfaces. The available components are categorized into Channel components, Message components, and Utility components:

    Channel Components

    • Channel List Screen: A full-screen implementation of the channel list.
    • Channel List View: The view used to display a list of channels.
    • Channel List Header View: The header component for the channel list screen.

    Message Components

    • Message List Screen: A full-screen implementation of the message list.
    • Message List View: The view used to display messages within a channel.
    • Channel Header View: The header component displayed at the top of a message screen.
    • Message Composer View: The input area for composing and sending messages.

    Utility Components

    • Mention List View: For selecting users to mention in messages.
    • Pinned Message List View: To display messages that have been pinned to a channel.
    • Search View: For searching within channels or messages.
    • Attachment Gallery: For viewing and managing message attachments.
  7. Understand the Stream Chat Android Icon Naming Convention

    develop

    Icons follow a specific naming pattern based on their source module. This allows developers to trace resource names directly back to the Figma design system.

    • Design System Icons (stream_design_ic_*): Used by stream-chat-android-compose (new Figma art) and stream-chat-android-ui-common (shared legacy art). These are derived from Figma component names converted from kebab-case to snake_case.
    • XML SDK Icons (stream_ui_ic_*): Used by stream-chat-android-ui-components (legacy design).

    Example Mapping:

    • Figma: arrow-down-circle $\rightarrow$ stream_design_ic_arrow_down_circle.xml
    • Figma: message-bubbles $\rightarrow$ stream_design_ic_message_bubbles.xml
  8. Naming conventions for Compose SDK components

    develop

    To maintain consistency, the SDK follows specific naming patterns:

    • Components: Avoid Android view-based suffixes like View. Use descriptive names (e.g., LoadingIndicator instead of LoadingView).
    • Listeners/Action Handlers: Use the present tense for action handlers (e.g., onChannelClick instead of onChannelClicked).
    • State: Append the State suffix to the Composable name for its state class (e.g., MessageItemState for the MessageItem Composable).
    • Resources: All resource names must be prefixed with stream_compose_.
  9. How the Stream Chat Android SDK is structured

    develop

    The SDK is composed of several distinct modules that allow developers to choose their level of abstraction:

    • Client Module: The core engine for API communication and event handling.
    • Offline Support Module: Provides local caching and automatic retries, exposed via Flow and LiveData APIs.
    • Compose UI Components Module: A high-level UI layer built specifically for Jetpack Compose.
    • UI Components Module: A high-level UI layer built for XML-based layouts.

    Note on Languages: While the SDK supports both Kotlin and Java, Kotlin is strongly recommended. The Compose UI Components module requires Kotlin because it relies on Kotlin compiler plugins.

  10. How Resource Merging handles Compose and XML icon overrides

    develop

    The SDK uses Android resource merging to provide different visual styles to different implementations while using the same code references.

    When an icon exists in both ui-common (legacy art) and compose (new Figma art) with the same name:

    • Compose apps automatically pick up the new Figma art from the compose module.
    • XML apps pick up the legacy art from the ui-common module.

    This allows shared logic in ui-common (like ChannelAction.kt) to reference a single icon name while ensuring the correct visual style is rendered based on the UI framework being used.

    Commonly Overridden Icons:

    • stream_design_ic_archive
    • stream_design_ic_delete
    • stream_design_ic_message_bubble
    • stream_design_ic_mute
    • stream_design_ic_pin
    • (and others listed in the documentation)