Let's integrate our SDK in few minutes

Getting started#
Download SDK Files
Download

Introduction#

Through our Chat SDK for Android, you can efficiently integrate real-time chat into your app. On the client-side implementation, you can initialize, configure and build the chat with minimal effort.

On the server-side, MirrorFly ensures reliable infra-management services for your chat within the app. All server setup related documents can be downloaded from control panel's download section. This and Initialization page provide the Chat SDK’s structure and installation steps, then goes through the preliminary steps of implementing the Chat SDK in your own project.

Note : The fastest way to see our Chat SDK in action is to build your chat app on top of our sample app. Make sure to change the application ID of the sample app to your own. To download sample app click here

Requirements#

The minimum requirements for Chat SDK for Android are:

  • Android Lollipop 5.0 (API Level 21) or above
  • Java 7 or higher
  • Gradle 4.1.0 or higher
info

Firebase authentication and other google services like translate API are not part MirrorFly SDK, you will be charged based on the usage by google. To use free quota credit details must be updated in goole payments. To know more about plans and pricing click here

SDK License Key#

Your SDK must be authenticated by MirrorFly server using License Key.

Please follow below step to get your license key:

Step 1: Create an account here in MirrorFly console, if you already have an account please goto step 3.

Step 2: Validate your account by following the steps provided in console and login to your account.

Step 3: Please login to your account here

Step 4: Copy license key under "Application info" in "Overview" page

Installation#

The SDK is already compiled into an AAR file. To use the SDK, the below AAR file has to be imported into the project. Chat sdk needs kotlin support in your project.

Step 1: Download the latest SDK from MirrorFly Control Panel Download's section

Step 2: Extract the files from downloaded zip file

Step 3: Create a new Android project or Open a existing project

Step 4: Add the following libraries in app/libs folder in the project

  • appbase.aar
  • flycommons.aar
  • flynetwork.aar
  • flydatabase.aar
  • videocompression.aar
  • flywebrtc.aar
  • xmpp.aar

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

implementation files('libs/appbase.aar')
implementation files('libs/flycommons.aar')
implementation files('libs/flynetwork.aar')
implementation files('libs/flydatabase.aar')
implementation files('libs/videocompression.aar')
implementation files('libs/flywebrtc.aar')
implementation files('libs/xmpp.aar')

Step 6: Add the below dependencies required by the SDk in app/build.gradle

dependencies {
...// your app dependencies
configurations {
all {
exclude group: 'org.json', module: 'json'
exclude group: 'xpp3', module: 'xpp3'
}
}
//For lifecycle listener
implementation 'android.arch.lifecycle:extensions:1.1.1'
annotationProcessor 'android.arch.lifecycle:compiler:1.1.1'
//For GreenDao
implementation 'de.greenrobot:greendao:2.1.0'
//For gson parsing
implementation 'com.google.code.gson:gson:2.8.1'
//for smack implementation
implementation 'org.igniterealtime.smack:smack-android:4.4.4'
implementation 'org.igniterealtime.smack:smack-tcp:4.4.4'
implementation 'org.igniterealtime.smack:smack-im:4.4.4'
implementation 'org.igniterealtime.smack:smack-extensions:4.4.4'
implementation 'org.igniterealtime.smack:smack-sasl-provided:4.4.4'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.facebook.stetho:stetho:1.3.1'
implementation 'com.hypertrack:hyperlog:0.0.10'
//for mobile number formatting
implementation 'io.michaelrocks:libphonenumber-android:8.9.14'
//Dagger Dependencies
api 'com.google.dagger:dagger:2.25.2'
kapt 'com.google.dagger:dagger-compiler:2.25.2'
api 'com.google.dagger:dagger-android:2.25.2'
api 'com.google.dagger:dagger-android-support:2.25.2'
kapt 'com.google.dagger:dagger-android-processor:2.25.2'
//coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.3'
//apicalls
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
implementation 'com.squareup.okhttp3:okhttp:4.2.0'
implementation 'com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2'
//stetho interceptor
implementation 'com.facebook.stetho:stetho-okhttp3:1.3.1'
//okhttp interceptor
implementation 'com.squareup.okhttp3:logging-interceptor:3.14.3'
}

Step 7: Add the below code in the app level build.gradle:

plugins {
...
id 'kotlin-android'
id 'kotlin-kapt'
}
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
packagingOptions {
exclude 'META-INF/AL2.0'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LGPL2.1'
exclude("META-INF/*.kotlin_module")
}
}

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

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

Terminology#

The below table contains some mostly used keywords in sdk with their explanation

keywordExplanation
userID/userBareIDUnique ID assigned for each user Ex: 12345678 (any alphanumeric). The below characters is not allowed in userId: U+0022 (") U+0026 (&) U+0027 (') U+002F (/) U+003A (:) U+003C (<) U+003E (>) U+0040 (@) userID should follow below specification: https://xmpp.org/extensions/xep-0106.html
userJid (or) JIDuserID+@+domain of the chat server Ex. 12345678@xmpp.chatsystem.dev.contus.us
groupID/groupBareIDUnique ID assigned for each group Ex: group123456 (any alphanumeric). GroupJID = groupID +@mix.+domain of the chat server Ex: group123456@mix.xmpp.mirrorfly.dev.contus.us`
info

Sdk is having a built-in functions to prepare the JID, Group JID. :::