The addInGroup method is used to add a new member to the Group. The member to be added in the group may belong to a different company, provided that the company and the member must already be registered with Bayun. Any existing member of the group can add a new member. The developer can enforce stricter access-mechanisms on top if desired (e.g. only group-owner or group-admin is allowed to add new members).
Method parameters :
groupId: Group Id of the Group.
groupMember : GroupMember with companyName and companyEmployeeId
success: Success block to be executed after member is added to the group.
failure: Failure block to be executed if member could not be added to the group, returns BayunError.
importcom.bayun_module.GroupMemberString companyEmployeeId = "<companyEmployeeId>";String companyName ="<companyName>";String groupId ="<groupId>";GroupMember groupMember =newGroupMember();groupMember.companyEmployeeId= companyEmployeeId;groupMember.companyName= companyName;//Success CallbackHandler.Callback success =new Handler.Callback() { @OverridepublicbooleanhandleMessage(Message message) {Log.d(TAG,"Member added in the Group successfully.");returnfalse; }}//Failure CallbackHandler.Callback failure =new Handler.Callback() { @OverridepublicbooleanhandleMessage(Message message) {String error =message.getData().getString("BayunError","");Log.d(TAG,"Error adding the group member.");returnfalse; }};bayunCore.addInGroup(groupId, groupMember, success, failure);
import com.bayun_module.GroupMember
val companyEmployeeId = "<companyEmployeeId>"
val companyName = "<companyName>"
val groupId = "<groupId>"
val groupMember: GroupMember = GroupMember()
groupMember.companyEmployeeId = companyEmployeeId
groupMember.companyName = companyName
//Success Callback
val success = Handler.Callback {
Log.d(TAG, "Member added in the Group successfully.")
false
}
//Failure Callback
val failure = Handler.Callback {
val error = it.data.getString("BayunError", "")
Log.d(TAG, "Error adding the group member.")
false
}
bayunCore.addInGroup(groupId, groupMember, success, failure)