Skip to main content
Quick Reference for AI Agents & Developers
  • Requires: CometChat SDK and UI Kit both configured
  • Implementation: Handle notification tap in AppDelegate or SceneDelegate
  • Parse payload: Extract call session ID from notification payload
  • Launch: Present CometChatIncomingCall view controller
  • Related: Ringing · Push Notifications · UI Kit
This guide helps you to launch an incoming call screen from the UI Kit library on receiving an incoming call notification.
CometChat SDK & UI Kit both need to be configured before launching the call screen.

Step 1. Process push notification payload and grab Call object

To present an incoming call screen, firstly you will need a Call object. You can grab this from the push notification payload itself of incoming call notification. You need to call CometChat.processMessage() method to process push notification payload.
userInfo Dictionary Structure:message Dictionary:sender Dictionary:aps Dictionary:alert Dictionary:
Method Signature:Return Tuple Structure:Call Object Properties:sender User Object:receiver User Object:CallStatus Enum Values:CallType Enum Values:

Step 2. Launch call screen (Method 1)

You can directly launch the view controller from the app delegate once you receive Call Object.
CometChatIncomingCall View Controller Setup:UIModalPresentationStyle Values:Call Object Properties Used for Display:sender User Object (Displayed on Incoming Call Screen):View Controller Presentation Flow:
If you are facing any difficulties while launching the Call Screen from App Delegate, then you can use another method.

Step 2. Launch call screen (Method 2)

You can launch the call screen from your base view controller instead of launching it from the App Delegate. This method uses NotificationCenter to trigger and present Call Screen.
  1. In this method you need to fire notification after you receive Call Object.
  2. In Notification’s user info you can pass Call Object to that desired notification.

Trigger notification from App Delegate

NotificationCenter.default.post() Method Parameters:userInfo Dictionary Structure:Call Object in userInfo:sender User Object:Notification Dispatch Flow:
  1. On the other hand, you need to observe for the above notification in your base view controller
  1. Base view controller is a controller that launches immediately after the app delegate.
  2. Base view controller should be present to observe the notification when notification fires.
  3. If the view controller is not present in the memory when a new notification receives, then it won’t launch Call Screen.

Observe notification in Base View Controller

Add selector method & Launch call screen

NSNotification Object Structure:userInfo Dictionary:Call Object Properties:sender User Object:CometChatIncomingCall Presentation Configuration:Selector Method Flow: