Skip to main content
Version: 5.21.0

ChatConfig

ChatConfig is the main SDK configuration container. It is passed to ChatCenterUI.init(...) or ChatCenterUI.initAsync(...) and defines network, push, input, and permission settings.

info

Network timeouts, SSL pinning, and backend connection are configured in separate configs: transport_config, network_config.

Constructor parameters

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

The ChatConfig constructor accepts 14 parameters — most are optional.

ParameterTypeModifiableRequiredDefaultDescription
transportConfigChatTransportConfigvalYesServer connection settings. See Transport config
networkConfigChatNetworkConfigvalYesTimeout and SSL settings. See Network config
keepWebSocketActiveBooleanvarNofalseKeep the WebSocket open after closing the chat. Deprecated — controlled by the server.
searchEnabledBooleanvarNofalseMessage search. Deprecated — controlled by the server.
attachmentsEnabledBooleanvalNotrueShow the attach button
linkPreviewEnabledBooleanvarNofalseLink previews (OpenGraph). Deprecated — controlled by the server.
voiceRecordingEnabledBooleanvarNofalseVoice messages. Deprecated — controlled by the server.
permissionsDescriptionDialogsEnabledBooleanvalNofalseShow dialogs explaining permission requests
autoScrollToLatestBooleanvalNofalseAuto-scroll to the latest messages. Deprecated — controlled by the server.
notificationImportanceIntvalNoIMPORTANCE_DEFAULTNotification channel priority. Applies on Android 8.0 (API 26) and above; on earlier versions, the value is ignored. See the warning below the table
surveyCompletionDelayIntvalNo3Survey hide delay, seconds. Deprecated — controlled by the server.
inputEnabledDuringQuickRepliesBooleanvalNofalseAllow text input while quick replies are shown
pendingIntentCreatorPendingIntentCreatorvarNoOpens ChatActivityHow to build the PendingIntent on a notification tap. See the example below
keepSocketActiveDuringOperatorSessionBooleanvarNofalseKeep the WebSocket while an operator dialog is open. Deprecated — controlled by the server.

The full list of deprecated parameters and their server-side replacements is in Deprecated parameters.

notificationImportance applies only on channel creation

Android registers the notification channel once. After the first push, the channel is created, and subsequent changes to notificationImportance will not affect it — until the app is reinstalled or the channel is manually reset in Android settings.

userInputEnabled

userInputEnabled is set only on an existing ChatConfig instance — it is not part of the constructor.

PropertyTypeDefaultDescription
userInputEnabledBooleantrueWhether the input field is available to the user. The field is not declared @Volatile: a write from a background thread does not guarantee visibility of the value in the chat.
val chatConfig = ChatConfig(
transportConfig = transportConfig,
networkConfig = networkConfig
)
chatConfig.userInputEnabled = false // temporarily block the input field

PendingIntentCreator

By default, a notification tap opens the built-in ChatActivity. If the app already has a host Activity through which the chat is opened, replacing pendingIntentCreator helps avoid opening two chat instances.

create() is called from NotificationWorker (WorkManager) on a background thread — you must not touch the UI inside the method. The appMarker parameter comes from the push message and may be null (in particular, for campaign notifications) or an empty string.

chatConfig.pendingIntentCreator = object : PendingIntentCreator {
override fun create(context: Context, appMarker: String?): PendingIntent? {
val intent = Intent(context, HostActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP
putExtra("open_chat", true)
}
var flags = PendingIntent.FLAG_CANCEL_CURRENT
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
flags = flags or PendingIntent.FLAG_IMMUTABLE
}
// requestCode must be unique: the same value for different Intents
// leads to mutual overwrite of the PendingIntent in the system.
return PendingIntent.getActivity(context, Random().nextInt(), intent, flags)
}
}
note

FLAG_IMMUTABLE is available since Android 6.0 (API 23). On Android 12 (API 31) and above, with targetSdk = 31+, PendingIntent.getActivity() requires one of the flags to be specified: FLAG_IMMUTABLE or FLAG_MUTABLE — otherwise it throws IllegalArgumentException. The SDK_INT >= M guard in the example is kept for compatibility with minSdk < 23.

Fields inherited from ChatConfigCore

These fields are inherited from the base ChatConfigCore class and are accessible on a ChatConfig instance via inheritance. They are read-only: they cannot be passed to the ChatConfig(...) constructor and cannot be reassigned.

PropertyTypeDefaultDescription
historyLoadingCountInt30Number of messages loaded when paging history. Deprecated — controlled by the server.
isShowClientFullNameInMessageBooleantrueShow the client's full name in messages or "You"

Deprecated parameters

Constructor parameters marked @Deprecated — the values now come from the server.

ParameterDefaultReplacementNote
keepWebSocketActivefalseServer settingOn Android 15+ (targetSdk = 35), background network access is not allowed by the system unless the app is in foreground. On earlier versions, subject to Doze, App Standby, and background network restrictions
keepSocketActiveDuringOperatorSessionfalseServer setting
searchEnabledfalseServer settingHistory search
linkPreviewEnabledfalseServer settingLink previews (OpenGraph)
voiceRecordingEnabledfalseServer settingVoice message recording
autoScrollToLatestfalseServer settingAuto-scroll
surveyCompletionDelay3Server settingSurvey hide delay (seconds)

The historyLoadingCount field is also marked @Deprecated, but you cannot pass it to the ChatConfig constructor — it stays at the default 30. See Fields inherited from ChatConfigCore.