Package 

Object DaakiaCallKit

    • Method Detail

      • canUseFullScreenIntent

         final static Boolean canUseFullScreenIntent()

        Whether the app may use full-screen intents, i.e. whether the incoming-call screen can appear over the lock screen. Always true below Android 14; on Android 14+ the user can revoke it, in which case the call shows as a heads-up notification only — check this and offer openFullScreenIntentSettings from your app's settings.

      • consumeLaunchEvent

         final static CallEvent consumeLaunchEvent(Intent intent)

        Recovers the call event carried by the intent that launched your activity — the accept-from-killed-state path, where the SDK starts your launcher activity because the user accepted a call while the app process was dead.

        Call it from your launcher activity's onCreate and onNewIntent:

        DaakiaCallKit.consumeLaunchEvent(intent)?.let { event ->
            // event.type is ACCEPTED (or INCOMING); join event.call
        }

        One-shot: the first call strips the SDK extras from intent and returns the event; later calls with the same intent (e.g. after a configuration change) return null.

      • registerDevice

         final static DeviceTokenRecord registerDevice(String username, String fcmToken)

        Registers this device's push token with the Daakia backend, so calls placed to username reach it.

        Call it after obtaining the FCM token (FirebaseMessaging.getInstance().token) and again from your messaging service whenever the token is refreshed.

        Parameters:
        username - Username the token is registered under; the same value callers pass to startCallByUsername.
        fcmToken - The device's current FCM registration token.
      • startCallByUsername

        @JvmOverloads() final static PushResult startCallByUsername(String username, IncomingCallData call, String message)

        Places a call by username: the backend resolves username to its registered devices and pushes the incoming call to them.

        DaakiaCallKit.startCallByUsername(
            username = "bob",
            call = IncomingCallData(callId = meetingUid, title = "Alice"),
        )
        Parameters:
        call - The call description; its title becomes the notification title and IncomingCallData.toDataJson the push's data object.
        message - Notification body sent alongside the payload.
      • startCallByUsername

        @JvmOverloads() final static PushResult startCallByUsername(String username, IncomingCallData call)

        Places a call by username: the backend resolves username to its registered devices and pushes the incoming call to them.

        DaakiaCallKit.startCallByUsername(
            username = "bob",
            call = IncomingCallData(callId = meetingUid, title = "Alice"),
        )
        Parameters:
        call - The call description; its title becomes the notification title and IncomingCallData.toDataJson the push's data object.
      • endCall

        @JvmOverloads() final static Unit endCall(String callId)

        Stops a ringing incoming call: silences the ringtone and vibration, removes the notification, closes the SDK's call screen if it is showing, and emits ai.daakia.callkit.model.CallEventType.ENDED.

        The case this exists for is the caller hanging up before the callee answers. When your app learns the call was cancelled — a second push, a socket message — call this, or the device keeps ringing until the timeout and reports a call-timeout that never happened:

        override fun onMessageReceived(message: RemoteMessage) {
            if (message.data["type"] == "call_cancelled") {
                DaakiaCallKit.endCall(message.data["callId"])
                return
            }
            if (DaakiaCallKit.handleRemoteMessage(message)) return
        }

        Purely local: it reports nothing to the backend. Use sendCallEvent with CallEventAction.END for that.

        Parameters:
        callId - Ends only the call with this id, so a stale cancellation cannot silence a newer call that started meanwhile.
      • endCall

        @JvmOverloads() final static Unit endCall()

        Stops a ringing incoming call: silences the ringtone and vibration, removes the notification, closes the SDK's call screen if it is showing, and emits ai.daakia.callkit.model.CallEventType.ENDED.

        The case this exists for is the caller hanging up before the callee answers. When your app learns the call was cancelled — a second push, a socket message — call this, or the device keeps ringing until the timeout and reports a call-timeout that never happened:

        override fun onMessageReceived(message: RemoteMessage) {
            if (message.data["type"] == "call_cancelled") {
                DaakiaCallKit.endCall(message.data["callId"])
                return
            }
            if (DaakiaCallKit.handleRemoteMessage(message)) return
        }

        Purely local: it reports nothing to the backend. Use sendCallEvent with CallEventAction.END for that.

      • configureCallEventFallback

        @JvmOverloads() final static Unit configureCallEventFallback(Set<CallEventAction> actions)

        Enables the killed-state fallback webhook: when the user accepts, declines, or lets a call time out, the SDK reports the matching CallEventAction to the backend even if the app process is not running (via WorkManager), using the base URL and secret captured from initialize's config at call time.

        The webhook body enriches metadata with caller_id, receiver_id, call_timestamp, delivery_mode: "fallback" and platform: "android".

        Passing an empty actions set clears the fallback, like clearCallEventFallback.

      • clearSentCallEventCache

         final static Unit clearSentCallEventCache()

        Clears the local dedupe cache of call events already reported to the backend, allowing the same meetingUid + action pair to be reported again.