Chat SDK for Android v1.2.1
agora java chat SDK
Public Member Functions | List of all members
io.agora.chat.ChatThreadManager Class Reference

Public Member Functions

void addChatThreadChangeListener (ChatThreadChangeListener listener)
 
void removeChatThreadChangeListener (ChatThreadChangeListener listener)
 
void createChatThread (String parentId, String messageId, String chatThreadName, ValueCallBack< ChatThread > callBack)
 
void getChatThreadFromServer (String chatThreadId, ValueCallBack< ChatThread > callBack)
 
void joinChatThread (String chatThreadId, ValueCallBack< ChatThread > callBack)
 
void destroyChatThread (String chatThreadId, CallBack callBack)
 
void leaveChatThread (String chatThreadId, CallBack callBack)
 
void updateChatThreadName (String chatThreadId, String chatThreadName, CallBack callBack)
 
void removeMemberFromChatThread (String chatThreadId, String member, CallBack callBack)
 
void getChatThreadMembers (String chatThreadId, int limit, String cursor, ValueCallBack< CursorResult< String > > callBack)
 
void getJoinedChatThreadsFromServer (int limit, String cursor, ValueCallBack< CursorResult< ChatThread > > callBack)
 
void getJoinedChatThreadsFromServer (String parentId, int limit, String cursor, ValueCallBack< CursorResult< ChatThread > > callBack)
 
void getChatThreadsFromServer (String parentId, int limit, String cursor, ValueCallBack< CursorResult< ChatThread > > callBack)
 
void getChatThreadLatestMessage (List< String > chatThreadIds, ValueCallBack< Map< String, ChatMessage > > callBack)
 

Detailed Description

The message thread manager that defines how to manage message threads, including message thread creation, destruction, and member management.

Member Function Documentation

◆ addChatThreadChangeListener()

void io.agora.chat.ChatThreadManager.addChatThreadChangeListener ( ChatThreadChangeListener  listener)

Adds the message thread event listener, which listens for message thread changes, such as the message thread creation and destruction.

You can call removeChatThreadChangeListener(ChatThreadChangeListener) to remove an unnecessary message thread event listener.

Parameters
listenerThe message thread event listener to add.

◆ createChatThread()

void io.agora.chat.ChatThreadManager.createChatThread ( String  parentId,
String  messageId,
String  chatThreadName,
ValueCallBack< ChatThread callBack 
)

Creates a message thread.

Each member of the chat group where the message thread belongs can call this method.

Upon the creation of a message thread, the following will occur:

Parameters
parentIdThe parent ID, which is the group ID.
messageIdThe ID of the parent message.
chatThreadNameThe name of the new message thread. It can contain a maximum of 64 characters.
callBackThe result callback:

◆ destroyChatThread()

void io.agora.chat.ChatThreadManager.destroyChatThread ( String  chatThreadId,
CallBack  callBack 
)

Destroys the message thread.

Only the owner or admins of the group where the message thread belongs can call this method.

Note

Parameters
chatThreadIdThe message thread ID.
callBackThe result callback:

◆ getChatThreadFromServer()

void io.agora.chat.ChatThreadManager.getChatThreadFromServer ( String  chatThreadId,
ValueCallBack< ChatThread callBack 
)

Gets the details of the message thread from the server.

Parameters
chatThreadIdThe message thread ID.
callBackThe result callback:

◆ getChatThreadLatestMessage()

void io.agora.chat.ChatThreadManager.getChatThreadLatestMessage ( List< String >  chatThreadIds,
ValueCallBack< Map< String, ChatMessage > >  callBack 
)

Gets the last reply in the specified message threads from the server.

Parameters
chatThreadIdsThe list of message thread IDs to query. You can pass a maximum of 20 message thread IDs each time.
callBackThe result callback:

◆ getChatThreadMembers()

void io.agora.chat.ChatThreadManager.getChatThreadMembers ( String  chatThreadId,
int  limit,
String  cursor,
ValueCallBack< CursorResult< String > >  callBack 
)

Gets a list of members in the message thread with pagination.

Each member of the group to which the message thread belongs can call this method.

Parameters
chatThreadIdThe message thread ID.
limitThe number of members that you expect to get on each page. The value range is [1,50].
cursorThe position from which to start getting data. At the first method call, if you set cursor to null or an empty string, the SDK will get data in the chronological order of when members join the message thread.
callBackThe result callback:

◆ getChatThreadsFromServer()

void io.agora.chat.ChatThreadManager.getChatThreadsFromServer ( String  parentId,
int  limit,
String  cursor,
ValueCallBack< CursorResult< ChatThread > >  callBack 
)

Use the pagination to get the list of message threads in the specified group.

This method gets data from the server.

Parameters
parentIdThe parent ID, which is the group ID.
limitThe number of message threads that you expect to get on each page. The value range is [1,50].
cursorThe position from which to start getting data. At the first method call, if you set cursor to null or an empty string, the SDK will get data in the reverse chronological order of when message threads are created.
callBackThe result callback:

◆ getJoinedChatThreadsFromServer() [1/2]

void io.agora.chat.ChatThreadManager.getJoinedChatThreadsFromServer ( int  limit,
String  cursor,
ValueCallBack< CursorResult< ChatThread > >  callBack 
)

Uses the pagination to get the list of message threads that the current user has joined.

This method gets data from the server.

Parameters
limitThe number of message threads that you expect to get on each page. The value range is [1,50].
cursorThe position from which to start getting data. At the first method call, if you set cursor to null or an empty string, the SDK will get data in the reverse chronological order of when the user joins the message threads.
callBackThe result callback:

◆ getJoinedChatThreadsFromServer() [2/2]

void io.agora.chat.ChatThreadManager.getJoinedChatThreadsFromServer ( String  parentId,
int  limit,
String  cursor,
ValueCallBack< CursorResult< ChatThread > >  callBack 
)

Use the pagination to get the list of message threads that the current user has joined in the specified group.

This method gets data from the server.

Parameters
parentIdThe parent ID, which is the group ID.
limitThe number of message threads that you expect to get on each page. The value range is [1,50].
cursorThe position from which to start getting data. At the first method call, if you set cursor to null or an empty string, the SDK will get data in the reverse chronological order of when the user joins the message threads.
callBackThe result callback:

◆ joinChatThread()

void io.agora.chat.ChatThreadManager.joinChatThread ( String  chatThreadId,
ValueCallBack< ChatThread callBack 
)

Joins a message thread.

Each member of the group where the message thread belongs can call this method.

In a multi-device login scenario, note the following:

Parameters
chatThreadIdThe message thread ID.
callBackThe result callback:

◆ leaveChatThread()

void io.agora.chat.ChatThreadManager.leaveChatThread ( String  chatThreadId,
CallBack  callBack 
)

Leaves a message thread.

Each member in the message thread can call this method.

In a multi-device login scenario, note the following:

Parameters
chatThreadIdThe ID of the message thread that the current user wants to leave.
callBackThe result callback:

◆ removeChatThreadChangeListener()

void io.agora.chat.ChatThreadManager.removeChatThreadChangeListener ( ChatThreadChangeListener  listener)

Removes the message thread event listener.

After a message thread event listener is added with addChatThreadChangeListener(ChatThreadChangeListener), you can call this method to remove it when it is not required.

Parameters
listenerThe message thread event listener to remove.

◆ removeMemberFromChatThread()

void io.agora.chat.ChatThreadManager.removeMemberFromChatThread ( String  chatThreadId,
String  member,
CallBack  callBack 
)

Removes a member from the message thread.

Only the owner or admins of the group where the message thread belongs and the message thread creator can call this method.

The removed member will receive the ChatThreadChangeListener#onChatThreadUserRemoved(ChatThreadEvent) callback.

You can listen for message thread events by setting ChatThreadChangeListener.

Parameters
chatThreadIdThe message thread ID.
memberThe user ID of the member to be removed from the message thread.
callBackThe result callback.

◆ updateChatThreadName()

void io.agora.chat.ChatThreadManager.updateChatThreadName ( String  chatThreadId,
String  chatThreadName,
CallBack  callBack 
)

Changes the name of the message thread.

Only the owner or admins of the group where the message thread belongs and the message thread creator can call this method.

Each member of the group to which the message thread belongs will receive the ChatThreadChangeListener#onChatThreadUpdated(ChatThreadEvent) callback.

You can listen for message thread events by setting ChatThreadChangeListener.

Parameters
chatThreadIdThe message thread ID.
chatThreadNameThe new message thread name. It can contain a maximum of 64 characters.
callBackThe result callback:

The documentation for this class was generated from the following file: