Skip to main content

Unread Message Count

The unread message count is a default feature provided by Global IM UIKit, which informs users of the number of unread messages in each conversation. The unread message count is displayed on the conversation entries in the ChatListFragment. The number of unread messages for each conversation is shown in the top-right corner of the conversation icon. If the number of unread messages exceeds 100, it will be displayed as 99+.

tip

To use the unread message count feature, you must first build the conversation list page. The bottom navigation bar is not implemented by default in Global IM UIKit.

(width=250)

Usage

Global IM UIKit has already implemented a complete set of logic for retrieving and displaying unread message counts by default. When using the default conversation list and conversation pages, there is no need to call additional conversation-related APIs.

When a user logs in on multiple devices, Global IM UIKit synchronizes the conversation read status across devices. You can also choose to disable this feature based on your business requirements. For more details, see Synchronize Read Status Across Devices.

Customization

If the existing implementation in Global IM UIKit does not meet your needs, you can use the relevant APIs in Global IM UIKit or IMLib SDK.

Retrieve Unread Message Count

Global IM UIKit does not directly provide an API to retrieve the unread message count. If you have custom requirements such as the following, you can call the relevant methods in the IMLib SDK.

  • Retrieve the unread message count for all conversations (IMLib method)
  • Retrieve the unread message count for a specific conversation (IMLib method)
  • Retrieve the unread message count by conversation type (IMLib method)

For specific core classes, APIs, and usage methods, refer to the IMLib documentation Handling Unread Message Count.

Note: The IMLib methods do not provide page refresh capabilities. You need to customize the notification mechanism based on your business requirements to refresh the page.

Synchronize Read Status Across Devices

In instant messaging services, the same user account may be logged in on multiple devices. Only after enabling the Multi-Device Message Synchronization service will RC synchronize message data across multiple devices. However, the read/unread status of messages in conversations on a device is stored locally.

Global IM UIKit has implemented the multi-device read status synchronization feature by default. After synchronization is initiated on one device, other devices can receive notifications and synchronize the read status as required. You can decide whether to use this feature based on your business needs. This feature is enabled by default.

RongConfigCenter.conversationConfig().setEnableMultiDeviceSync(true);