Skip to content

kindly-ai/sdk-chat-android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kindly SDK for Android

This is the official Kindly SDK for Android. This SDK allows you to integrate Kindly's chat functionality into your Android application.

Installation

Follow these steps to install the Kindly SDK into your Android project.

Step 1: Add the JitPack repository to your build file

Groovy

Add the following lines to your root build.gradle file:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Kotlin DSL

pluginManagement {
    repositories {
        ...
        maven(url = "https://jitpack.io")
    }
}

Step 2: Add the dependency

Groovy

dependencies {
	implementation "com.github.kindly-ai:sdk-chat-android:TAG"
}

Kotlin DSL

dependencies {
	implementation("com.github.kindly-ai:sdk-chat-android:TAG")
}

Find the latest version here

Step 3: Initialize the SDK

In your Application class, initialize the SDK as follows:

class App: Application() {
    override fun onCreate() {
        super.onCreate()
				
      	// 🌿 Initialize the SDK
        KindlySDK.start(
            application = this,
            botKey = "BOT_KEY",
            languageCode = "en",
        )
    }
}

Usage

After installing the SDK, you can now use it in your Android application.

To launch the chat, call KindlySDK.launchChat(context = context) in your activity or fragment:

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            MyApplicationTheme {
                Box(modifier = Modifier.fillMaxSize()) {
                    MyButton()
                }
            }
        }
    }
}

@Composable
fun MyButton() {
    val context = LocalContext.current
    Button(onClick = {
      	// 🌿 Display the SDK screen
        KindlySDK.launchChat(context = context)
    },) {
        Text(text = "Click Here")
    }
}

Support

If you encounter any issues or require further assistance, feel free to create an issue in this repository or contact Kindly's support team.

Additional Information

For more information, please refer to the following resources: