Skip to main content

Group call

This page describes the public group calling capabilities in Nexconn Call SDK for Android, including how to start a group call, join a call, invite participants, and handle call type upgrades.

CapabilityAPI
Start a group callstartCall(List<String>, NCCallType.MULTI, NCCallMediaType)
Start a group call with push or extrastartCall(List<String>, NCCallType.MULTI, NCCallMediaType, INCCallPushConfig, String)
Join an existing group calljoinCall(String callId)
Invite participantsinviteToCall(List<String>)
Invite participants with push or extrainviteToCall(List<String>, INCCallPushConfig, String)
End or leave a callendCall(String callId) or endCall()

Start a group call

Set callType to NCCallType.MULTI for group calls.

Java
List<String> userIds = Arrays.asList("user_a", "user_b");

NCCallEngine.getInstance().startCall(
userIds,
NCCallType.MULTI,
NCCallMediaType.VIDEO
);

The asynchronous result is returned through INCCallAPIResultListener#onStartCall(...):

Java
NCCallEngine.getInstance().setAPIResultListener(new INCCallAPIResultListener() {
@Override
public void onStartCall(
NCCallCode code,
String callId,
List<INCCallUser> busyLineUserList
) {
// code == NCCallCode.SUCCESS means the call started successfully
// busyLineUserList contains users who are already on another call
}
});

Receive and join a group call

Invited users receive the incoming call through INCCallEventsListener#onCallReceived(...). After that, they can:

  • Call acceptCall(callId) to accept the current invitation.
  • Call joinCall(callId) to join an ongoing group call when callId is already known.
  • Call endCall(callId) to reject the invitation or leave the current call.
Java
@Override
public void onCallReceived(INCCallSession callSession, String extra) {
String callId = callSession.getCallId();

// Example: accept the current group call
NCCallEngine.getInstance().acceptCall(callId);
}

Invite additional users

After a 1-to-1 call or a group call is established, you can invite more users:

Java
NCCallEngine.getInstance().inviteToCall(
Arrays.asList("user_c", "user_d")
);

The result is returned through onInviteToCall(...). Other participants receive the invitation event through onRemoteUserInvited(...).

Java
@Override
public void onRemoteUserInvited(
String callId,
ArrayList<String> inviteeUserList,
String inviterUserId
) {
// Invitation event broadcast received
}

Upgrade a 1-to-1 call to a group call

When a third participant is successfully invited into a 1-to-1 call, the current call can be upgraded to a group call. The SDK reports this through onCallTypeChanged(...):

Java
@Override
public void onCallTypeChanged(String callId, NCCallType callType) {
if (callType == NCCallType.MULTI) {
// The current call session has been upgraded to a group call
}
}

Video views in a group call

In a group call, you usually create a separate remote view for each participant:

Java
List<INCCallRemoteVideoView> remoteViews = new ArrayList<>();
remoteViews.add(new NCCallRemoteVideoView(context, "user_a", false));
remoteViews.add(new NCCallRemoteVideoView(context, "user_b", true));

NCCallEngine.getInstance().setVideoView(remoteViews);

If a participant leaves or you no longer need to show that participant's video, call removeVideoView(List<String> userIds) to remove the corresponding remote view.

End the call and manage call logs

  • To leave the current group call, call endCall() or endCall(callId).
  • The end result is returned through onEndCall(...).
  • The final server-side call log is returned through onServerCallLogReceived(INCCallLog).
  • Query call history with getHistoryCallLogs(long syncTime, int count, NCCallLogOrder order).