Group message

5.1 Obtain an XHGroupManager Instance and add Group Event Listeners

示例:

XHGroupManager groupManager = XHClient.getInstance().getGroupManager();
groupManager.addListener(new IXHGroupManagerListener() {
@Override
public void onMembersUpdeted(String groupID, int number) {
//member number change
}

@Override
public void onSelfKicked(String groupID) {
//You are removed from the current group
}

@Override
public void onGroupDeleted(String groupID) {
//Group deleted notification
}

@Override
public void onReceivedMessage(XHIMMessage message) {
//Receive group message
}

});

5.2 XHGroupManager API Description

/**
* Add listener
* @param groupManagerListener IXHGroupManagerListener Group event listener
*/
void addListener(IXHGroupManagerListener groupManagerListener);

/**
* Create a group
* @param groupName Group name
* @param callback result callback
*/
void createGroup(String groupName,IXHResultCallback callback);

/**
* Delete the group
* @param groupID group ID
* @param callback result callback
*/
void deleteGroup(String groupID,IXHResultCallback callback);

/**
Add group members
@param memberIds the array of Member ID
@param groupID group ID
@param callback result callback
*/
void addGroupMembers(String groupID, ArrayList<String> memberIDs, IXHResultCallback callback);

/**
Delete group member
@param memberIds the array of Member ID
@param groupID group ID
@param callback result callback
*/
void deleteGroupMembers(String groupID,ArrayList<String> memberIDs, IXHResultCallback callback);

/**
* Set push switch
* @param groupID group ID
* @param enable Whether to push group messages
* @param callback result callback
*/
void setPushEnable(String groupID,Boolean enable,IXHResultCallback callback);

/**
*Send a message,and Offline users can receive historical messages after going online。
* @param groupID group ID
* @param atUserIDs @user
* @param Message message cotent
* @param callback result callback
* @return message object
*/
XHIMMessage sendMessage(String groupID, ArrayList<String> atUserIDs, String Message, IXHResultCallback callback);

/**
*Send group online message, which only the current online user can receive, and offline users who go online again can't receive the history message.
* @param groupID group ID
* @param atUserIDs @user
* @param Message message cotent
* @param callback result callback
* @return message object
*/
XHIMMessage sendOnlineMessage(String groupID, ArrayList<String> atUserIDs, String Message, IXHResultCallback callback);