showCallkitIncoming presents the native call UI. On iOS this uses Apple’s CallKit framework — the same full-screen lock-screen experience built into the Phone app. On Android a custom full-screen notification is used because there is no system CallKit equivalent.
iOS CallKit only works on a real device. The simulator does not support the CallKit framework.
Show the incoming call screen
Generate a UUID for the call
Every call must have a unique UUID. Use the
uuid package to generate one and keep it for the lifetime of the call.Key parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. Must be a UUID. Use the same UUID for all subsequent operations on this call (end, mute, hold, etc.). |
nameCaller | String | Caller name displayed on the incoming call screen. |
handle | String | Phone number, email address, or any identifier for the caller. |
type | int | 0 for audio call, 1 for video call. Defaults to 0. |
duration | int | Milliseconds to display the incoming call UI. When the timer expires the call is marked as missed. Defaults to 30000. |
avatar | String | URL of the caller’s avatar image (Android only). |
extra | Map | Arbitrary data passed through to every call event on this call. |
Hide the call notification (Android)
After the user accepts or declines a call on Android, dismiss the incoming call notification by callinghideCallkitIncoming.
This method is Android-only. On iOS CallKit manages its own UI lifecycle.
Mark the call as connected
CallsetCallConnected once your WebRTC or P2P session is fully established. On iOS this resets the call timer in the Phone app history; on Android it fires a callback event.
Get active calls
UseactiveCalls to check for ongoing calls, for example when the app is launched from a terminated state.
Firebase background message handler
If you are triggeringshowCallkitIncoming from a Firebase Cloud Messaging background handler, annotate the handler with @pragma('vm:entry-point') so the Dart VM does not tree-shake it.
Call events
Listen to accept, decline, timeout, and other lifecycle events.
Notifications
Configure missed call and calling notifications.
