1-to-1 call
This page describes the current public 1-to-1 calling capabilities in Nexconn Call SDK for Android.
Key types
| Type | Description |
|---|---|
NCCallEngine | Call entry point. Starts, accepts, and ends calls, controls devices, and queries call logs. |
INCCallSession | Current call session object. Includes callId, callType, mediaType, participant list, and related data. |
INCCallUser | Participant state object. |
INCCallEventsListener | Callback for incoming calls, connected calls, ended calls, participant state changes, media switching, and call logs. |
INCCallAPIResultListener | Asynchronous 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.
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.
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:
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.
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(...):
@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
// 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
NCCallEngine engine = NCCallEngine.getInstance();
engine.enableMicrophone(true);
boolean micEnabled = engine.isMicrophoneEnabled();
engine.enableSpeaker(true);
boolean speakerEnabled = engine.isSpeakerphoneEnabled();
Camera
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(...).
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
NCCallEngine.getInstance().requestChangeMediaType(NCCallMediaType.VIDEO);
The result is returned through onRequestChangeMediaType(...). The remote user receives onMediaTypeChangeRequestReceived(...).
Respond to a change request
@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
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
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.