Integrate the Chat SDK

Step 1: Add the following to your root build.gradle file.

allprojects {
repositories {
maven {url ""}

Step 2: Add the following dependencies in the app/build.gradle file.

android {
packagingOptions {
exclude 'META-INF/AL2.0'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LGPL2.1'
dependencies {
configurations {
all {
exclude group: 'org.json', module: 'json'
exclude group: 'xpp3', module: 'xpp3'
implementation 'com.mirrorfly.sdk:appbase:0.0.10'

Step 3: Add the below line in the file, to avoid imported library conflicts.


Step 4: Open the AndroidManifest.xml and add below permissions.

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

STEP 4:Download flysdk and extract the Android supporing files and move into Android project

  • FlyBaseController.kt
  • FlyEvent.kt

Configure in app/build.gradle file#

android {
compileSdkVersion 33
defaultConfig {
minSdkVersion 21
targetSdkVersion 33
buildTypes {
debug {
buildConfigField 'String', 'SDK_BASE_URL', '""'
buildConfigField 'String', 'LICENSE', '"xxxxxxxxxxxxxxxxxxxxxxxxx"'
buildConfigField 'String', 'WEB_CHAT_LOGIN', '""'
buildConfigField "String", "SUPPORT_MAIL", '""'

Initialize Chat SDK#

Create Android Application#

In Android porject create a new class called MyApplication and copy the below code snippet in the MyApplication file.

class MyApplication : FlutterApplication() {
init {
instance = this
companion object {
private var instance: MyApplication? = null
fun getContext(): Context {
return instance!!.applicationContext
override fun onCreate() {

Add the following override methods in your Android main activity#

override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
FlyBaseController(this).onActivityResult(requestCode, resultCode, data)
override fun onResume() {
override fun onDestroy() {

To start using the sdk, there is a need for some basic requirements before proceeding with the initialization process. Thus, the ChatSDK builder class is used to provide the necessary data to the SDK. In your Android Application class, inside the onCreate() method use the below ChatSDK Builder to provide the necessary data.

//For chat logging
new ChatSDK.Builder()

Chat Builder Function Description#

FunctionParameter TypeDescription
setDomainBaseUrlStringUrl is provided to make API calls
setLicenseKeyStringLicense key is required to proceed with registration
setIsTrialLicenceKeybooleanIf the provided license key is for trial version, display the text as ‘true’ else ‘false’
buildn/aInitializes the chat configuration

The base URL must have the Http/Https protocol which must be closed with a ‘slash (/)’, if not an exception - a bug message will pop up.