Skip to main content

1-to-1 call

This page describes the current public 1-to-1 calling capabilities in Nexconn Call SDK for Android.

Key types

TypeDescription
NCCallEngineCall entry point. Starts, accepts, and ends calls, controls devices, and queries call logs.
INCCallSessionCurrent call session object. Includes callId, callType, mediaType, participant list, and related data.
INCCallUserParticipant state object.
INCCallEventsListenerCallback for incoming calls, connected calls, ended calls, participant state changes, media switching, and call logs.
INCCallAPIResultListenerAsynchronous result callback for startCall, acceptCall, endCall, requestChangeMediaType, and related APIs.

Add listeners

Register the event listener before IM connects, and register the result listener after initialization completes.

Java
NCCallEngine engine = NCCallEngine.getInstance();

engine.setCallEventsListener(new INCCallEventsListener() {
@Override
public void onCallReceived(INCCallSession callSession, String extra) {
}

@Override
public void onCallConnected(INCCallSession callSession) {
}

@Override
public void onCallEnded(INCCallSession session, NCCallEndReason reason) {
}

@Override
public void onRemoteUserStateChanged(
String callId,
String userId,
NCCallUserState status,
NCCallEndReason reason
) {
}
});

engine.setAPIResultListener(new INCCallAPIResultListener() {
@Override
public void onStartCall(
NCCallCode code,
String callId,
List<INCCallUser> busyLineUserList
) {
}

@Override
public void onAcceptCall(NCCallCode code, String callId) {
}

@Override
public void onEndCall(NCCallCode code, String callId) {
}
});

Set video views

For a 1-to-1 video call, you typically need one local view and one remote view.

Java
NCCallLocalVideoView localView = new NCCallLocalVideoView(context);
localView.setScalingType(NCCallRenderMode.FILL);

NCCallRemoteVideoView remoteView =
new NCCallRemoteVideoView(context, remoteUserId, false);
remoteView.setScalingType(NCCallRenderMode.FILL);

NCCallEngine engine = NCCallEngine.getInstance();
engine.setVideoView(localView);
engine.setVideoView(Collections.singletonList(remoteView));

If you no longer need to show a remote video stream, call:

Java
NCCallEngine.getInstance().removeVideoView(
Collections.singletonList(remoteUserId)
);

Start a 1-to-1 call

For a 1-to-1 call, callType must be NCCallType.SINGLE, and userIds must contain exactly one callee.

Java
NCCallEngine.getInstance().startCall(
Collections.singletonList(remoteUserId),
NCCallType.SINGLE,
NCCallMediaType.VIDEO
);

The result is returned through onStartCall(...). If the callee accepts the call, both users receive onCallConnected(...).

Receive and accept an incoming call

The callee receives the call session and extra through onCallReceived(...):

Java
@Override
public void onCallReceived(INCCallSession callSession, String extra) {
String callId = callSession.getCallId();

if (callSession.getMediaType() == NCCallMediaType.VIDEO) {
NCCallEngine.getInstance().setVideoView(localView);
NCCallEngine.getInstance().setVideoView(Collections.singletonList(remoteView));
}

NCCallEngine.getInstance().acceptCall(callId);
}

If the user is already on another call, the current code comments require you to call endCall(String) first and then call acceptCall(String) for the new incoming call.

End the call

Java
// End the current active call
NCCallEngine.getInstance().endCall();

// Or end a specific call by callId
NCCallEngine.getInstance().endCall(callId);

The asynchronous result is returned through onEndCall(...), and the call end event is returned through onCallEnded(...).

Control devices during the call

Microphone and speaker

Java
NCCallEngine engine = NCCallEngine.getInstance();

engine.enableMicrophone(true);
boolean micEnabled = engine.isMicrophoneEnabled();

engine.enableSpeaker(true);
boolean speakerEnabled = engine.isSpeakerphoneEnabled();

Camera

Java
NCCallEngine engine = NCCallEngine.getInstance();

engine.enableCamera(true);
engine.switchCamera();

The current Android code comments indicate that the camera is off by default after a video call is connected. Your app must explicitly call enableCamera(true).

Audio and video configuration

Before the call is connected, configure capture parameters with setVideoConfig(...) and setAudioConfig(...).

Java
INCCallVideoConfig videoConfig = CallVideoConfigImpl.Builder.create()
.setVideoResolution(NCCallVideoResolution.RESOLUTION_480_640)
.setVideoFps(NCCallVideoFrameRate.Fps_15)
.setMinRate(200)
.setMaxRate(900)
.build();

NCCallEngine.getInstance().setVideoConfig(videoConfig);

The current repository also exposes INCCallAudioConfig and CallAudioConfigImpl.Builder.create(). However, this snapshot does not clearly document full parameter passthrough behavior. If you need custom audio processing parameters, verify the behavior in the actual release package that you ship with.

Switch media type

1-to-1 calls support switching between audio and audio-video modes.

Send a change request

Java
NCCallEngine.getInstance().requestChangeMediaType(NCCallMediaType.VIDEO);

The result is returned through onRequestChangeMediaType(...). The remote user receives onMediaTypeChangeRequestReceived(...).

Respond to a change request

Java
@Override
public void onMediaTypeChangeRequestReceived(
String transactionId,
String userId,
NCCallMediaType mediaType
) {
NCCallEngine.getInstance().replyChangeMediaType(transactionId, true);
}

The final result is returned through onMediaTypeChangeResultReceived(...). To cancel an existing request, call cancelChangeMediaType(transactionId).

Call logs

Call log callbacks after the call ends

  • onLocalCallLogReceived(INCCallLog callLog)
  • onServerCallLogReceived(INCCallLog callLog)

Query history with pagination

Java
NCCallEngine.getInstance().getHistoryCallLogs(
-1,
20,
NCCallLogOrder.DESC
);

The result is returned through onGetHistoryCallLogs(...). If hasMore is true, use the returned syncTime to request the next page.

Delete logs

Java
NCCallEngine.getInstance().deleteCallLogsForMe(
Collections.singletonList(callId)
);

NCCallEngine.getInstance().deleteAllCallLogsForMe();

Quality metrics and frame capture

If you need network quality data or captured audio and video frames, use:

  • setConnectionQualityListener(...)
  • setVideoFrameCaptureListener(...)
  • setAudioFrameCaptureListener(...)

These callbacks are useful for quality dashboards, debugging, and custom data processing.