Adjust how users access the Knowledge Base

Customize the Knowledge Base screen behavior and load specific articles dynamically.
Written by Alex
Updated 1 week ago

The showKbScreen function allows you to display the HelpCrunch Knowledge Base (KB) screen within your app, enabling users to seamlessly access articles and resources. This function is highly configurable, supporting localization settings, custom options, and callbacks for managing user interactions.


Function Signature

@JvmStatic
@JvmOverloads
fun showKbScreen(
    articleUrl: String,
    forceApplyLocaleFromUrl: Boolean = false,
    options: HCOptions? = null,
    callback: Callback<Any?>? = null
)

Parameters

Parameter Type Default Value Description
articleUrl String Required The URL of the article to display on the Knowledge Base screen.
forceApplyLocaleFromUrl Boolean false If true, the SDK enforces the locale based on the articleUrl.
options HCOptions? null An optional HCOptions model for customizing the appearance and behavior of the widget interface.
callback Callback<Any?>? null An optional callback for handling events related to opening the Knowledge Base screen.

Usage Examples

Basic Usage

Open a Knowledge Base article without additional configurations:

HelpCrunch.showKbScreen(
    articleUrl = "https://docs.helpcrunch.com/en/android-sdk/add-helpcrunch-android-sdk-to-your-app"
)

Enforcing Locale from the Article URL

Force the article to appear in the language specified in the articleUrl:

HelpCrunch.showKbScreen(
    articleUrl = "https://docs.helpcrunch.com/en/android-sdk/add-helpcrunch-android-sdk-to-your-app", 
    forceApplyLocaleFromUrl = true
)

Customizing the Knowledge Base Screen with HCOptions

Similar to opening a chat, you can customize the Knowledge Base screen using HCOptions:

val options = HCOptions.build {
    setTheme(HCTheme.Builder(HCTheme.Type.DARK).build()) // Apply dark mode
    setArticlesLocalizedPreviewEnabled(true) // Enable localized KB previews in chat
}

HelpCrunch.showKbScreen(
    articleUrl = "https://docs.helpcrunch.com/en/android-sdk/add-helpcrunch-android-sdk-to-your-app",
    options = options
)
Did this answer your question?