Skip to main content
The CometChatIncomingCall component serves as a visual representation when the user receives an incoming call, such as a voice call or video call, providing options to answer or decline the call.
CometChatIncomingCall showing incoming call interface with caller avatar, name, and accept/reject buttons

Usage

Integration

CometChatIncomingCall is a custom view controller that offers versatility in its integration. It can be seamlessly launched via button clicks or any user-triggered action, enhancing the overall user experience and facilitating smoother interactions within the application.
If you are already using a navigation controller, you can use the pushViewController function instead of presenting the view controller.

Actions

Actions dictate how a component functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the component to fit your specific needs.

1. SetOnAcceptClick

The setOnAcceptClick action is typically triggered when the user clicks on the accept button, initiating a predefined action. However, by implementing the following code snippet, you can easily customize or override this default behavior to suit your specific requirements.

2. SetOnCancelClick

The setOnCancelClick action is typically triggered when the user clicks on the reject button, initiating a predefined action. However, by implementing the following code snippet, you can easily customize or override this default behavior to suit your specific requirements.

3. OnError

You can customize this behavior by using the provided code snippet to override the On Error and improve error handling.

Filters

Filters allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized experience. Filters can be applied using RequestBuilders of Chat SDK. The IncomingCall component does not have any exposed filters.

Events

Events are emitted by a Component. By using events you can extend existing functionality. Being global events, they can be applied in multiple locations and are capable of being added or removed. Events emitted by the Incoming Call component are as follows:


Customization

To fit your app’s design requirements, you can customize the appearance of the conversation component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.

Style

Using Style you can customize the look and feel of the component in your app. These parameters typically control elements such as the color, size, shape, and fonts used within the component.

1. IncomingCall Style

You can customize the appearance of the IncomingCall Component by applying the IncomingCallStyle to it using the following code snippet. Global level styling
Instance level styling
CometChatIncomingCall with custom styling showing custom fonts and rounded button corners
List of properties exposed by IncomingCallStyle:

Functionality

These are a set of small functional customizations that allow you to fine-tune the overall experience of the component.

Advanced

For advanced-level customization, you can set custom views to the component. This lets you tailor each aspect of the component to fit your exact needs and application aesthetics. You can create and define your views, layouts, and UI elements and then incorporate those into the component.

SetListItemView

With this function, you can assign a custom view to the incoming call item view.
Demonstration:
CometChatIncomingCall with custom list item view showing compact call notification with avatar and action buttons
You can create a CustomListItemView as a custom UIView:

SetLeadingView

You can modify the leading view of an Incoming call component using the property below.
Demonstration:
CometChatIncomingCall with custom leading view showing PRO USER badge with star icon
You can create a CustomLeadingView as a custom UIView:

SetTitleView

You can customize the title view of an incoming call component using the property below.
Demonstration:
CometChatIncomingCall with custom title view showing Voice Call label with Important tag
You can create a CustomTitleView as a custom UIView which we will inflate in setTitleView():

Props

All props are optional unless noted.

call

The incoming call object to display.

disableSoundForCalls

Disables the incoming call ringtone.

customSoundForCalls

Custom sound file URL for incoming calls.

avatarStyle

Customizes the appearance of the caller’s avatar.

Events

Events emitted by the Incoming Call component:

View Slots

subtitleView

You can customize the subtitle view of an incoming call component using the property below.

trailingView

You can customize the trailing view of an incoming call component using the property below.

Common Patterns

Present Incoming Call Screen

Present the incoming call screen when a call is received:

Handle Call Accept and Navigate to Ongoing Call

Transition from incoming call to ongoing call when accepted:

Custom Ringtone for Incoming Calls

Set a custom sound for incoming calls:

Outgoing Call

Display outgoing call interface

Ongoing Call

Display active call interface

Call Logs

Display call history