Chat Info

ChatInfo is a specialized template component designed for messaging scenarios. Unlike BaseInfo, which is generic, ChatInfo optimizes the layout for conversation updates, focusing on the sender’s avatar (profile picture) and the message body.

It is typically used in conjunction with the Dynamic Island to show the sender’s avatar when the notification is expanded.

Usage

builder.setChatInfo(
    title = "John Doe",
    content = "Hey, are we still meeting for lunch?",
    pictureKey = "avatar_john",
    
    // Optional: Badge the avatar with an app icon
    appPkg = "com.whatsapp",
    
    // Custom Colors
    titleColor = "#000000",
    contentColor = "#666666"
)

Content Parameters

ParameterTypeDescription
titleStringRequired. The sender’s name or group title.
contentString?The message body text.
(Note: Mutually exclusive with timer. If a timer is provided, content is ignored).
pictureKeyString?Key of the HyperPicture to use as the user avatar.
pictureKeyDarkString?Optional different avatar image for Dark Mode.
appPkgString?Package name of an app (e.g., com.whatsapp). If provided, the system may overlay the app’s small icon on the avatar.

Timer Configuration

You can replace the text content with a live timer (useful for “Call in progress” or “Voice recording”).

// Example: Timer counting UP from a specific start time
val timer = TimerInfo(
    type = 1, // 1 = Count Up
    baseTime = System.currentTimeMillis()
)

builder.setChatInfo(
    title = "Voice Call",
    timer = timer,
    pictureKey = "caller_avatar"
)

Color Customization

Like BaseInfo, you can customize the text colors for both Light and Dark modes.

Text FieldLight Mode ParameterDark Mode Parameter
Sender NametitleColortitleColorDark
MessagecontentColorcontentColorDark

Actions

The setChatInfo method accepts an optional actionKeys list. These actions appear as standard buttons at the bottom of the card.

actionKeys = listOf("reply", "mark_read")