Skip to main content
Version: 5.21.0

Quick start

A "5 minutes" scenario: from the dependency added to your first opened chat.

Before you start

  • providerUid — the unique app key issued by edna.
  • Server URL — a full URL like https://name.edna.io (issued by edna).
  • SDK is connected — the dependency is added to Gradle (see Installation).
Don't have the connection data?

providerUid and the URL are shown to the edna Chat Center administrator on the Android channel's "Setup" tab — contact them. Step-by-step instructions: Connecting the Android mobile chat. If your organization does not have access to the edna admin panel, write to support.

Step 1. Initialization in Application

Create your own Application class and initialize the SDK once:

import edna.chatcenter.ui.visual.core.ChatCenterUI
import edna.chatcenter.ui.visual.ChatConfig
import edna.chatcenter.core.config.transport.ChatTransportConfig
import edna.chatcenter.core.config.transport.ChatNetworkConfig

class MyApp : Application() {

lateinit var chatCenterUI: ChatCenterUI

override fun onCreate() {
super.onCreate()

val chatConfig = ChatConfig(
ChatTransportConfig(cloudHost = "https://name.edna.io"),
ChatNetworkConfig()
)

chatCenterUI = ChatCenterUI(applicationContext).apply {
init(providerUid = "YOUR_PROVIDER_UID", config = chatConfig)
}
}
}

Don't forget to declare the class in AndroidManifest.xml: <application android:name=".MyApp" ...>.

init() — before any other SDK calls

authorize(...), handleFCMMessage(...) / handlePushMessage(...) before init() completes lead to IllegalStateException. See SDK initialization for details.

Step 2. Authorize the user

Once your app has authenticated the user, pass their identifier to the SDK:

import edna.chatcenter.core.config.ChatUser

val user = ChatUser(identifier = "user-uuid-12345")
chatCenterUI.authorize(user, null)

The second parameter null is used when server-side authorization via ChatAuth (Bearer token) is not used. See Authorization for details.

Step 3. Display the chat

Add a container to your Activity layout:

<FrameLayout
android:id="@+id/chat_container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

In your Activity, embed ChatFragment:

import edna.chatcenter.core.annotation.OpenWay
import edna.chatcenter.ui.visual.fragments.ChatFragment

val chatCenterUI = (application as MyApp).chatCenterUI
val chatFragment = chatCenterUI.getChatFragment()
?: ChatFragment.newInstance(OpenWay.DEFAULT)

supportFragmentManager.beginTransaction()
.replace(R.id.chat_container, chatFragment)
.commit()

Alternatives (the ready-made ChatActivity, BottomSheet, edge-to-edge, "Back" handling) are in Displaying the chat.

What's next