Getting Started
The Android SDK enables your app to have community features. Here we are going to talk about how you can integrate chat SDK in your app. Since this is build to manage the community, a lot of features are provided by default. These include group chat, guest flow, deep link support and even analytics to be sent to your marketing or analytics tools(such as Mixpanel, CleverTap, WebEngage, etc.). Follow below steps to add LikeMinds SDK in your Android Project:
Basic Setup
- Generate API key from the LikeMinds Dashboard.
a. Enable Chatrooms and Direct Messages settings from Features & Settings section on the LikeMinds Dashboard. - Fork our repository Chat Repository from Github.
- Add the forked Repo as submodule in your project by running the following command.
git submodule add <link-of-the-forked-repo>
git submodule update --init --recursive - Include the
chatmm
project in your project by pasting the following code in yoursettings.gradle
.include ':chatmm'
project(':chatmm').projectDir = new File(rootDir, '<name-of-the-forked-project>/chatmm/') - If you are not using navigation library already, add the following code in your project level
build.gradle
.buildscript {
...
apply from: '<name-of-the-forked-project>/lm-chat-root-dependencies.gradle'
dependencies {
classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.6.0'
}
}noteIf there is any conflict between the the navigation safe args gradle plugin version, go to
lm-chat-root-dependencies.gradle
and changelm_chat_versions.navigation
to your version. - Add the following code (if not already added) in your dependency resolution management.
maven { url "https://jitpack.io" }
- Enable
dataBinding
in your project (if not done already) by adding the following code in your app levelbuild.gradle
.android {
buildFeatures {
dataBinding = true
}
} - Now sync your project gradle and you will see chatmm module in your project directory.
Add Chat in your code
Once the
chatmm
project is setup, open yourApplication
class and add the following code inonCreate()
function to initiateLikeMindsChatUI
.LikeMindsChatUI.initiateChatUI(
this,
null,
null
)Now to inflate the
LMChatFragment
add the following code in your activity.val apiKey = "Your generated API key"
val userName = "Test User"
val userId = "test_user"
val isGuest = false
LikeMindsChatUI.initiateChatFragment(
this,
R.id.frameLayout,
apiKey,
userName,
userId,
isGuest
)
Now you should have LikeMinds Chat Community live in your app.