Floating messages - KaleyraVideo/VideoAndroidSDK GitHub Wiki

Custom floating messages can be displayed on the call UI to show a message and a call-to-action. The body of the floating message, as well as the button's text, icon and action, can be customized by setting the relevant parameters on the message object.

To display a custom floating message on the call UI, refer to the following code snippet:

val floatingMessage = FloatingMessage(
  body = "body",
  button = FloatingMessage.Button(
    text = "text", 
    icon = R.drawable.kaleyra_icon_reply, 
    action = {
      Toast.makeText(this, "tap", Toast.LENGTH_SHORT).show()
    }
  )
)

fun displayFloatingMessage() {
    KaleyraVideo.conference.call.replayCache.firstOrNull()?.present(floatingMessage)
}

// if floating message is referenced in your activity
override fun onDestroy() {
  KaleyraVideo.conference.call.replayCache.firstOrNull()?.dismiss(floatingMessage)
  super.onDestroy()
}

Important:

Floating messages are strongly referenced within the SDK. To prevent memory leaks, always dismiss floating messages in the onDestroy() method of your activity if they are referenced within it.