Skip to main content

Clear Message Unread Status

The ultra group service supports synchronizing message read status across multiple clients.

Synchronize Message Read Status

Calling the read status synchronization interface will simultaneously clear the unread status of messages recorded both locally and on the server. The server will then synchronize the latest status to other clients logged in with the same user account.

  • If a channel ID (channelId) is specified, all messages in that channel will be marked as read, and the status will be synchronized to other clients.
  • If the channel ID is empty, all messages in the ultra group conversation that do not belong to any channel will be marked as read, and the status will be synchronized to other clients.
tip

Ultra groups currently do not support read status synchronization by timestamp. Calling syncUltraGroupReadStatus will mark all messages as read according to the specified parameters. The timestamp parameter (timestamp) is unused and can accept any numeric value.

Interface

class OperationCallback {
void onSuccess()
void onError(ErrorCode code)
}

public void syncUltraGroupReadStatus(final String targetId, final String channelId, final long timestamp, final IRongCoreCallback.OperationCallback callback)

Parameter Description

ParameterTypeDescription
targetIdStringUltra group conversation targetId.
channelIdStringUltra group conversation channel channelId.
timestamplongThis field is invalid; any numeric value can be passed.
callbackOperationCallbackInterface callback

Monitor Message Read Time

You can set the setUltraGroupReadTimeListener listener to monitor ultra group read synchronization notifications:

interface UltraGroupReadTimeListener {
/**
Ultra group read time synchronization

@param targetId Conversation ID
@param channelId Channel ID
@param readTime Read time (when the server cleared the unread count)
*/
void onUltraGroupReadTimeReceived(String targetId, String channelId, long time);
}

public void setUltraGroupReadTimeListener(IRongCoreListener.UltraGroupReadTimeListener listener)