7.5 Get Group By Id
The getGroupById
returns details of a group. Details include groupId, name, type, groupMembers. Any existing member of the group can retrieve details of the group, including the list of all the group members.
Method parameters :
groupId : Group Id of the Group.
success : Success block to be executed after group details are successfully retrieved.
failure : Failure block to be executed if group details could not be retrieved, returns
BayunError
.
String groupId = "<groupId>";
Group groupDetails;
// Callbacks to get group info by its id
Handler.Callback success = new Handler.Callback() {
@Override
public boolean handleMessage(Message message) {
Log.d(TAG, "Get group by id call successful.");
groupDetails = (Group)message.getData().getSerializable("BayunGetGroup");
Log.d(TAG, "group id: " + groupDetails.groupId);
Log.d(TAG, "group name: " + groupDetails.groupName);
Log.d(TAG, "group type: " + groupDetails.groupType);
ArrayList<GroupMember> groupMembers = (ArrayList<GroupMember>)groupDetails.groupMembers;
for (GroupMember member: groupMembers) {
Log.d(TAG, "companyEmployeeId: " + member.companyEmployeeId));
Log.d(TAG, "companyId: " + member.companyId);
Log.d(TAG, "companyName: " + member.companyName));
}
return false;
}
};
Handler.Callback failure = new Handler.Callback() {
@Override
public boolean handleMessage(Message message) {
String error = message.getData().getString("BayunError", "");
Log.d(TAG, "Error getting group.");
return false;
}
};
bayunCore.getGroupById(groupId, success, failure);
Last updated
Was this helpful?