Skip to main content

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

  1. Generate API key from the LikeMinds Dashboard.
    a. Enable Chatrooms and Direct Messages settings from Features & Settings section on the LikeMinds Dashboard.
  2. Fork our repository Chat Repository from Github.
  3. 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
  4. Include the chatmm project in your project by pasting the following code in your settings.gradle.
    include ':chatmm'
    project(':chatmm').projectDir = new File(rootDir, '<name-of-the-forked-project>/chatmm/')
  5. 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'
    }
    }
    note

    If there is any conflict between the the navigation safe args gradle plugin version, go to lm-chat-root-dependencies.gradle and change lm_chat_versions.navigation to your version.

  6. Add the following code (if not already added) in your dependency resolution management.
    maven { url "https://jitpack.io" }
  7. Enable dataBinding in your project (if not done already) by adding the following code in your app level build.gradle.
    android {
    buildFeatures {
    dataBinding = true
    }
    }
  8. Now sync your project gradle and you will see chatmm module in your project directory.

Add Chat in your code

  1. Once the chatmm project is setup, open your Application class and add the following code in onCreate() function to initiate LikeMindsChatUI.

    LikeMindsChatUI.initiateChatUI(
    this,
    null,
    null
    )
  2. 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.