-
public class IncomingCallUiContract between the core call pipeline and a full-screen incoming-call Activity.
callkit-ui-composeandcallkit-ui-viewsbuild on this to provide ready-made call screens; a host app with its own call UI uses it directly: register the Activity with registerActivity, read the call from the launch intent with launchPayload, and report the user's choice with acceptCall / declineCall. While ringing, keep an onCallClosed subscription and finish the Activity when the ringing call ends elsewhere (timeout, remote end, accept from the notification).
-
-
Field Summary
Fields Modifier and Type Field Description public final static IncomingCallUiINSTANCE
-
Method Summary
Modifier and Type Method Description final static UnitregisterActivity(Class<out Activity> activityClass)Registers activityClass as the full-screen incoming-call Activity. final static UnitclearRegisteredActivity()Undoes registerActivity; incoming calls fall back to notification-only behavior. final static IncomingCallPayloadlaunchPayload(Intent intent)Extracts the incoming call carried by an Activity launch intent, or nullwhen the intent does not carry a (parseable) Daakia call payload — in which case the call screen should finish immediately.final static BooleanisAcceptLaunch(Intent intent)Whether intent launched the Activity because the user already accepted the call from the notification action. final static UnitacceptCall(Activity activity)Accepts the ringing call from the call screen: stops the ringing, emits ai.daakia.callkit.model.CallEventType.ACCEPTED, reports the fallback webhook if configured, and launches the host app with the call extras (recoverable via ai.daakia.callkit.DaakiaCallKit.consumeLaunchEvent). final static UnitdeclineCall(Context context)Declines the ringing call: stops the ringing and emits ai.daakia.callkit.model.CallEventType.DECLINED. final static AutoCloseableonCallClosed(Context context, Function1<String, Unit> onClosed)Subscribes to the end of the ringing phase. -
-
Method Detail
-
registerActivity
final static Unit registerActivity(Class<out Activity> activityClass)
Registers activityClass as the full-screen incoming-call Activity. It becomes the target of the notification's full-screen intent (shown over the lock screen) and of its accept action.
The Activity is started with the payload and action source as intent extras; use launchPayload and isAcceptLaunch to read them. With no registered Activity the call still rings as a heads-up CallStyle notification and accept launches the host app.
-
clearRegisteredActivity
final static Unit clearRegisteredActivity()
Undoes registerActivity; incoming calls fall back to notification-only behavior.
-
launchPayload
final static IncomingCallPayload launchPayload(Intent intent)
Extracts the incoming call carried by an Activity launch intent, or
nullwhen the intent does not carry a (parseable) Daakia call payload — in which case the call screen should finish immediately.
-
isAcceptLaunch
final static Boolean isAcceptLaunch(Intent intent)
Whether intent launched the Activity because the user already accepted the call from the notification action. The call screen should skip rendering: call acceptCall and finish.
-
acceptCall
final static Unit acceptCall(Activity activity)
Accepts the ringing call from the call screen: stops the ringing, emits ai.daakia.callkit.model.CallEventType.ACCEPTED, reports the fallback webhook if configured, and launches the host app with the call extras (recoverable via ai.daakia.callkit.DaakiaCallKit.consumeLaunchEvent).
activity must be the call screen launched by the SDK — the call payload is read from its intent. Finish the Activity afterwards.
-
declineCall
final static Unit declineCall(Context context)
Declines the ringing call: stops the ringing and emits ai.daakia.callkit.model.CallEventType.DECLINED. Finish the Activity afterwards.
-
onCallClosed
final static AutoCloseable onCallClosed(Context context, Function1<String, Unit> onClosed)
Subscribes to the end of the ringing phase. onClosed receives the
callIdof the call whose ringing ended, ornullwhen every call screen should close regardless — finish the Activity when the value isnullor matches the call being shown.Returns an AutoCloseable subscription to close when the Activity stops; subscribe from
onStartand close fromonStop.
-
-
-
-