Skip to content

ApplicationCall

Lejla Solak edited this page Mar 31, 2025 · 17 revisions



id()

Description

Returns a unique call identifier.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
String id = applicationCall.id();



options()

Description

Returns call options used to construct an application call.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
ApplicationCallOptions applicationCallOptions = applicationCall.options();



customData()

Description

Getter for the customData field.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
Map<String, String> customData = applicationCall.customData();



status()

Description

Returns current call status.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
CallStatus callStatus = applicationCall.status();



duration()

Description

Returns call duration in seconds calculated from the time call was established. Initially, duration is 0.

Arguments

  • none

Returns

  • int - Call duration

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
int callDuration = applicationCall.duration();



startTime()

Description

Returns the time when the call started (but was not yet established).

Arguments

  • none

Returns

  • Date - Time when the call was initiated.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
Date startTime = applicationCall.startTime();



establishTime()

Description

Returns the time when the call was established. Initially, establishTime is null.

Arguments

  • none

Returns

  • Date - Time when the call was established.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
Date establishTime = applicationCall.establishTime();



endTime()

Description

Returns the time when the call finished. Initially, endTime is null.

Arguments

  • none

Returns

  • Date - Time when the call finished

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
Date endTime = applicationCall.endTime();



callsConfigurationId()

Description

Returns a unique Calls Configuration identifier associated with your Calls Configuration logical entity created through our Calls API.

Arguments

  • none

Returns

String - Represents the Calls Configuration ID which is configured using the Calls Configuration API.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
String callsConfigurationId = applicationCall.callsConfigurationId();



participants()

Description

Returns the list of participants currently connected with this application call.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
List<Participant> participants = applicationCall.participants();



remoteVideos()

Description

Returns a list of participant's camera videos and screen shares.

Arguments

  • none

Returns

  • Map<String, RemoteVideo> - List of participant's camera videos and screen shares. Can be accessed by participant identifier.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
Map<String, RemoteVideo> remoteVideos = applicationCall.remoteVideos();



mute(shouldMute)

Description

Toggles mute option.

Arguments

  • shouldMute: boolean - Whether call should be muted after action or not.

Returns

  • N/A

Throws

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    try {
        applicationCall.mute(true);
    } catch (ActionFailedException e) {
        Log.w("App", String.format("Failed to execute action. Error: %s", e.getErrorCode().getDescription()));
    }
}



muted()

Description

Returns information whether audio is muted or not.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
boolean muted = applicationCall.muted();



speakerphone(enabled)

Description

Controls whether the audio should be played on the speakerphone. Disabled by default. If disabled, the audio will be played through the next available audio device based on the priority order.

Arguments

  • enabled: boolean - Whether sound should be played on the speakerphone or not.

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    applicationCall.speakerphone(true);
}



speakerphone()

Description

Returns information whether speakerphone is enabled or not.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
boolean speakerphone = applicationCall.speakerphone();



sendDTMF(dtmf)

Description

Simulates key-press by sending DTMF (Dual-Tone Multi-Frequency) entry.

Arguments

  • dtmf: String - One of the allowed DTMF characters:
    • digits: 0 to 9
    • letters: A to D
    • symbols: * and #

Returns

  • N/A

Throws

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    try {
        applicationCall.sendDTMF("1");
    } catch (ActionFailedException e) {
        Log.w("App", String.format("Failed to execute action. Error: %s", e.getErrorCode().getDescription()));
    }
}



cameraVideo(cameraVideo)

Description

Toggles whether camera video should be enabled or not. For video calls it is enabled by default.

Arguments

  • cameraVideo: boolean - Whether camera video should be enabled or not.

Returns

  • N/A

Throws

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    try {
        applicationCall.cameraVideo(true);
    } catch (ActionFailedException e) {
        Log.w("App", String.format("Failed to execute action. Error: %s", e.getErrorCode().getDescription()));
    }
}



hasCameraVideo()

Description

Returns information whether the current application call has camera video or not.

Arguments

  • none

Returns

  • boolean - Represents whether the application call has camera video. true if it does, otherwise false.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
boolean hasCameraVideo = applicationCall.hasCameraVideo();



startScreenShare(screenCapturer)

Description

Starts sharing screen with the remote peer. Needs to be called after CallEstablishedEvent is received.

Note: Starting from Android 14, screen share must be started from a foreground service. For more information, please refer to the Screen Share tutorial.

Arguments

Returns

  • N/A

Throws

Example

private void startScreenShare(int resultCode, Intent data) {
    try {
        ScreenCapturer screenCapturer = new ScreenCapturer(resultCode, data);
        ApplicationCall applicationCall = InfobipRTC.getInstance().getActiveApplicationCall();
        if (applicationCall != null) {
            applicationCall.startScreenShare(screenCapturer);
        }
    } catch (ActionFailedException e) {
        Log.e("ScreenShareService", "Failed to start screen share", e);
    }
}



resetScreenShare()

Description

The size of the media projection can change when the device is rotated or the user selects an app window as the capture region in app screen sharing. The media projection might be letterboxed if the captured content differs from the window size obtained when screen sharing started.

To prevent this and ensure the projection matches the captured content’s size and aspect ratio, use this method to resize the capture whenever the content changes - whether due to rotation or a different windowing mode.

Note: On Android 14 and later, the system automatically handles resizing, so you only need to call this method on earlier versions. If called on Android 14 or later, it has no effect as it is ignored.

Arguments

  • none

Returns

  • N/A

Example

Specify the configuration changes your app handles by setting the android:configChanges attribute of the <activity> element in your AndroidManifest.xml file.

Note: Android handles any configuration changes you don't specify in configChanges; that is, the system destroys and recreates your app's activities.

For example, enable your app to handle screen size and orientation changes:

<activity
        android:name=".MainActivity"
        android:configChanges="orientation|screenSize"/>
public class MainActivity extends AppCompatActivity {
    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);

        // Check for screen size or orientation changes
        if ((newConfig.configChanges & (Configuration.CONFIG_SCREEN_SIZE | Configuration.CONFIG_ORIENTATION)) != 0) {
            InfobipRTC infobipRTC = InfobipRTC.getInstance();
            ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
            applicationCall.resetScreenShare();
        }
    }
}



stopScreenShare()

Description

Stops sharing screen with the remote peer.

Arguments

  • none

Returns

  • N/A

Throws

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    try {
        applicationCall.stopScreenShare();
    } catch (ActionFailedException e) {
        Log.w("App", String.format("Failed to execute action. Error: %s", e.getErrorCode().getDescription()));
    }
}



hasScreenShare()

Description

Returns true if screen is being shared, otherwise else false.

Arguments

  • none

Returns

  • boolean - Whether screen is being shared or not

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
boolean hasScreenShare = applicationCall.hasScreenShare();



localCameraTrack()

Description

Returns video track for local camera video.

Arguments

  • none

Returns

Example

private void example() {
    VideoRenderer localCameraVideoRenderer = findViewById(R.id.local_camera_video);
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    RTCVideoTrack localCamera = applicationCall.localCameraTrack();
    if (localCamera != null) {
        localCamera.addSink(localCameraVideoRenderer);
    }
}



localScreenShareTrack()

Description

Returns video track for local screen share.

Arguments

  • none

Returns

  • RTCVideoTrack - Represents participant's screen share video track.

Example

private void example() {
    VideoRenderer localScreenShareVideoRenderer = findViewById(R.id.local_screen_share_video);
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    RTCVideoTrack localScreenShare = applicationCall.localScreenShareTrack();
    if (localScreenShare != null) {
        localScreenShare.addSink(localScreenShareVideoRenderer);
    }
}



setEventListener(applicationCallEventListener)

Description

Configures event handler for application call events.

Arguments

  • applicationCallEventListener: ApplicationCallEventListener - Interface with event methods that should be implemented, method per application call event to be handled.

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    applicationCall.setEventListener(new DefaultApplicationCallEventListener() {
        @Override
        public void onRinging(CallRingingEvent callRingingEvent) {
            Toast.makeText(getApplicationContext(), "Ringing!", Toast.LENGTH_LONG);
        }

        @Override
        public void onEstablished(CallEstablishedEvent callEstablishedEvent) {
            Toast.makeText(getApplicationContext(), "Established!", Toast.LENGTH_LONG);
        }

        @Override
        public void onHangup(CallHangupEvent callHangupEvent) {
            Toast.makeText(getApplicationContext(), "Hangup!", Toast.LENGTH_LONG);
        }

        @Override
        public void onError(ErrorEvent errorEvent) {
            Toast.makeText(getApplicationContext(), "Error!", Toast.LENGTH_LONG);
        }
    });
}



getEventListener()

Description

Returns event handler for application call events.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
ApplicationCallEventListener applicationCallEventListener = applicationall.getEventListener();



cameraOrientation(cameraOrientation)

Description

Change local camera orientation.

Arguments

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    applicationCall.cameraOrientation(VideoOptions.CameraOrientation.BACK);
}



cameraOrientation()

Description

Get current camera orientation.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
VideoOptions.CameraOrientation cameraOrientation = applicationCall.cameraOrientation();



pauseIncomingVideo()

Description

Pauses incoming video media.

Arguments

  • none

Returns

  • N/A

Throws

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    try {
        applicationCall.pauseIncomingVideo();
    } catch (ActionFailedException e) {
        Log.w("App", String.format("Failed to execute action. Error: %s", e.getErrorCode().getDescription()));
    }
}



resumeIncomingVideo()

Description

Resumes incoming video media.

Arguments

  • none

Returns

  • N/A

Throws

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    try {
        applicationCall.resumeIncomingVideo();
    } catch (ActionFailedException e) {
        Log.w("App", String.format("Failed to execute action. Error: %s", e.getErrorCode().getDescription()));
    }
}



setNetworkQualityEventListener(networkQualityEventListener)

Description

Configures event handler for local network quality events.

Arguments

  • networkQualityEventListener: NetworkQualityEventListener - Interface that should be implemented in order to handle local network quality events properly.

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    applicationCall.setNetworkQualityEventListener(networkQualityChangedEvent -> {
        NetworkQuality networkQuality = networkQualityChangedEvent.getNetworkQuality();
        Log.i("App", String.format("Local network quality is: %s (score: %s)", networkQuality, networkQuality.getScore()));
    });
}



getNetworkQualityEventListener()

Description

Returns event handler for local network quality events.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
NetworkQualityEventListner networkQualityEventListner = applicationCall.getNetworkQualityEventListener();



setParticipantNetworkQualityEventListener(participantNetworkQualityEventListener)

Description

Configures event handler for other participant's network quality events.

Arguments

  • participantNetworkQualityEventListener: ParticipantNetworkQualityEventListener - Interface that should be implemented in order to handle other participant's network quality events properly.

Returns

  • N/A

Example

    private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    applicationCall.setParticipantNetworkQualityEventListener(participantNetworkQualityChangedEvent -> {
        Participant participant = participantNetworkQualityChangedEvent.getParticipant();
        NetworkQuality networkQuality = participantNetworkQualityChangedEvent.getNetworkQuality();
        Log.i("App", String.format("%s's network quality changed to %s (value %s)", participant.getEndpoint().identifier(), networkQuality, networkQuality.getScore()));
    });
}



getParticipantNetworkQualityEventListener()

Description

Returns event handler for other participant's network quality events.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
ParticipantNetworkQualityEventListener participantNetworkQualityEventListener = applicationCall.getParticipantNetworkQualityEventListener();



audioDeviceManager()

Description

Returns the instance of AudioDeviceManager that should be used to manage the audio devices in the current call.

Arguments

  • none

Returns

  • AudioDeviceManager - An instance of AudioDeviceManager specifically designed for handling audio devices.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
AudioDeviceManager audioDeviceManager = applicationCall.audioDeviceManager();



audioQualityMode(audioQualityMode)

Description

Sets the audio quality mode to a given enum value.

Arguments

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    applicationCall.audioQualityMode(AudioOptions.AudioQualityMode.LOW_DATA);
}



audioQualityMode()

Description

Returns the audio quality mode that is used during the call.

Arguments

  • none

Returns

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    AudioOptions.AudioQualityMode audioQualityMode = applicationCall.audioQualityMode();
}



dataChannel()

Description

Returns the instance of DataChannel that should be used to send and receive data during the current call.

Arguments

  • none

Returns

  • DataChannel - An instance of DataChannel specifically designed for handling actions on data channel. null if data channel is not enabled in call options.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
DataChannel dataChannel = applicationCall.dataChannel();



getVideoFilter()

Description

This method returns the instance of VideoFilter currently in use.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
VideoFilter videoFilter = applicationCall.getVideoFilter();



setVideoFilter(videoFilter)

Description

This method sets the video filter to be used during the video call. Passing null will remove and release any already existing video filter.

Arguments

  • videoFilter: VideoFilter - An instance of VideoFilter.

Returns

  • N/A

Example

private void example() {
    VideoFilter videoFilter = createVideoFilter();
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    applicationCall.setVideoFilter(videoFilter);
}



clearVideoFilter()

Description

This convenience method removes the video filter if it is present.

Arguments

  • none

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    applicationCall.clearVideoFilter();
}



hangup()

Description

Hangs up call.

Arguments

  • none

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
    applicationCall.hangup();
}



getRecordingState()

Description

Returns the instance of the current RecordingState.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
ApplicationCall applicationCall = infobipRTC.getActiveApplicationCall();
RecordingState recordingState = applicationCall.getRecordingState();

Tutorials

Migration guides

Reference documentation

Clone this wiki locally