Add live chat in android using Kommunicate

Whether you are a small business or big enterprise, customers need prompt support. The first thing that comes to our mind is live chat. Given that the world is going mobile-first, it is important to have live chat implemented properly on your mobile website and apps as well. In this simple tutorial, we will learn how to add live chat in Android apps.

We will be using Kommunicate Android Live Chat SDK, which is free to get started with. I have created a sample in Github for your reference as well.

Steps by Step Guide to Add Live Chat in Android Apps

Basic Setup

Adding Gradle Dependency 

First thing first, let’s add Gradle dependency in your project and rebuild it.

dependencies {
implementation 'io.kommunicate.sdk:kommunicateui:1.9.3'
}

Setup Your SDK

You need to initialize the SDK with the Kommunicate Application ID (APP_ID). You can get the Kommunicate APP_ID by signing up for Kommuncate and navigating to the Install section.

More details can be found here as well. Add below code in onCreate method in your activity where you want to add Live Chat.

Kommunicate.init(context, APP_ID );

Launch Live Chat

Floating buttons are widely used in Live Chat, I am using email action in my sample here. You can use your custom buttons as well. Now, we are ready to launch our live chat. Add below code into ‘click listener’ of the live chat button from where you want to launch chat.

 new KmConversationBuilder(MainActivity.this)
        .launchConversation(new KmCallback() {
            @Override
            public void onSuccess(Object message) {
                Log.d("Conversation", "Success : " + message);
            }
    @Override
            public void onFailure(Object error) {
                Log.d("Conversation", "Failure : " + error);
            }
        }); 

This how a conversation list and conversation look inside your app.

Customizations

Here are a few customizations you can do to your Android live chat. Note that, these are optional.

Email collection before starting a chat

Sometimes we need to collect the email before users start the actual live chat. This is normally termed as ‘Lead collection’. To collect lead’s email, you just need to add one more setting in the above method while launching live chat.

 new KmConversationBuilder(MainActivity.this)
        .setWithPreChat(true)
        .launchConversation(new KmCallback() {
            @Override
            public void onSuccess(Object message) {
                Log.d("Conversation", "Success : " + message);
            }
            @Override
            public void onFailure(Object error) {
                Log.d("Conversation", "Failure : " + error);
            }
        }); 

You can get more information about pre-chat lead collection here.

Change colors, themes, and other customizations

You can change the colors, fonts, themes and add ton os other customization to your newly added live chat. Here are the detailed instruction to customize the live chat SDK.

Notification Setup

If you want to enable notification for incoming messages you can follow the steps here

Wrapping Up

In a few simple steps, you can get started with new-age sales and customer service by adding live chat to your Android apps.

Suggested read:
– How to add live chat in websites?
– How to add a chatbot in the Android app?


At Kommunicate, we are envisioning a world-beating customer support solution to empower the new era of customer support. We would love to have you onboard to have a first-hand experience of Kommunicate. You can signup here and start delighting your customers right away.

Write A Comment