hyphenate_SDK4.0 4.8.0
hyphenate java IM SDK
Public Member Functions | List of all members
com.hyphenate.chat.EMChatThreadManager Class Reference

Public Member Functions

void addChatThreadChangeListener (EMChatThreadChangeListener listener)
 
void removeChatThreadChangeListener (EMChatThreadChangeListener listener)
 
void createChatThread (String parentId, String messageId, String chatThreadName, EMValueCallBack< EMChatThread > callBack)
 
void getChatThreadFromServer (String chatThreadId, EMValueCallBack< EMChatThread > callBack)
 
void joinChatThread (String chatThreadId, EMValueCallBack< EMChatThread > callBack)
 
void destroyChatThread (String chatThreadId, EMCallBack callBack)
 
void leaveChatThread (String chatThreadId, EMCallBack callBack)
 
void updateChatThreadName (String chatThreadId, String chatThreadName, EMCallBack callBack)
 
void removeMemberFromChatThread (String chatThreadId, String member, EMCallBack callBack)
 
void getChatThreadMembers (String chatThreadId, int limit, String cursor, EMValueCallBack< EMCursorResult< String > > callBack)
 
void getJoinedChatThreadsFromServer (int limit, String cursor, EMValueCallBack< EMCursorResult< EMChatThread > > callBack)
 
void getJoinedChatThreadsFromServer (String parentId, int limit, String cursor, EMValueCallBack< EMCursorResult< EMChatThread > > callBack)
 
void getChatThreadsFromServer (String parentId, int limit, String cursor, EMValueCallBack< EMCursorResult< EMChatThread > > callBack)
 
void getChatThreadLatestMessage (List< String > chatThreadIds, EMValueCallBack< Map< String, EMMessage > > 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 com.hyphenate.chat.EMChatThreadManager.addChatThreadChangeListener ( EMChatThreadChangeListener  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(EMChatThreadChangeListener) to remove an unnecessary message thread event listener.

Parameters
listenerThe message thread event listener to add.

◆ createChatThread()

void com.hyphenate.chat.EMChatThreadManager.createChatThread ( String  parentId,
String  messageId,
String  chatThreadName,
EMValueCallBack< EMChatThread 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 com.hyphenate.chat.EMChatThreadManager.destroyChatThread ( String  chatThreadId,
EMCallBack  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 com.hyphenate.chat.EMChatThreadManager.getChatThreadFromServer ( String  chatThreadId,
EMValueCallBack< EMChatThread callBack 
)

Gets the details of the message thread from the server.

Parameters
chatThreadIdThe message thread ID.
callBackThe result callback:

◆ getChatThreadLatestMessage()

void com.hyphenate.chat.EMChatThreadManager.getChatThreadLatestMessage ( List< String >  chatThreadIds,
EMValueCallBack< Map< String, EMMessage > >  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 com.hyphenate.chat.EMChatThreadManager.getChatThreadMembers ( String  chatThreadId,
int  limit,
String  cursor,
EMValueCallBack< EMCursorResult< 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 com.hyphenate.chat.EMChatThreadManager.getChatThreadsFromServer ( String  parentId,
int  limit,
String  cursor,
EMValueCallBack< EMCursorResult< EMChatThread > >  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 com.hyphenate.chat.EMChatThreadManager.getJoinedChatThreadsFromServer ( int  limit,
String  cursor,
EMValueCallBack< EMCursorResult< EMChatThread > >  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 com.hyphenate.chat.EMChatThreadManager.getJoinedChatThreadsFromServer ( String  parentId,
int  limit,
String  cursor,
EMValueCallBack< EMCursorResult< EMChatThread > >  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 com.hyphenate.chat.EMChatThreadManager.joinChatThread ( String  chatThreadId,
EMValueCallBack< EMChatThread 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 com.hyphenate.chat.EMChatThreadManager.leaveChatThread ( String  chatThreadId,
EMCallBack  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 com.hyphenate.chat.EMChatThreadManager.removeChatThreadChangeListener ( EMChatThreadChangeListener  listener)

Removes the message thread event listener.

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

Parameters
listenerThe message thread event listener to remove.

◆ removeMemberFromChatThread()

void com.hyphenate.chat.EMChatThreadManager.removeMemberFromChatThread ( String  chatThreadId,
String  member,
EMCallBack  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 EMChatThreadChangeListener#onChatThreadUserRemoved(EMChatThreadEvent) callback.

You can listen for message thread events by setting EMChatThreadChangeListener.

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

◆ updateChatThreadName()

void com.hyphenate.chat.EMChatThreadManager.updateChatThreadName ( String  chatThreadId,
String  chatThreadName,
EMCallBack  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 EMChatThreadChangeListener#onChatThreadUpdated(EMChatThreadEvent) callback.

You can listen for message thread events by setting EMChatThreadChangeListener.

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: