How to Add Chatbot to Android App
Tags: android
Published: 2023-03-05 08:19:01

<!-- wp:paragraph -->
<p>It is never too late to learn a new stack and begin developing skills in it. And if you're seeking guidance on how to add a chatbot to your Android app, you've come to the right place.<br><br>Chatbots have become indispensable for everything from ordering food to checking your bank balance. And they are unquestionably useful in that they answer all customer questions and, as a result, generate some business. ChatBots in Android can be used in a lot of ways and they can help in customer service, sales and marketing and so on. This article will explain how to add a chatbot to your Android App using <a href="https://www.kommunicate.io/">Kommunicate</a></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><br><a href="https://www.kommunicate.io/product/kompose-bot-builder">Kompose </a>by Kommunicate is one such AI-chatbot builder. They provide learn and grow algorithms built in that learn with each conversation.So let's get right into it and start building an Android chatbot.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Build a chatbot for your Android app by creating an account in Kommunicate.</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>It's simple; Use the Kommunicate dashboard or create your own using the <a href="https://dashboard.kommunicate.io/signup?product=kommunicate">signup page</a>, navigate to the bot section, and select the create bot option to build a chatbot; if not, experiment with the sample bots that are already provided. Integrating the Kompose chatbot into your Android app is quick. As a result, we'll walk you through the steps so you can begin answering support questions in minutes.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh5.googleusercontent.com/ZhpUHpn2GaL6TCyLDdQ1YbabpAUtyTKtu4LgbM0Poua9PJvIN6MkVIEFv23Xqjy6_IT16IYQmduTDl_rimGMtbSyU47cl0BMQgvRCQ8EW-I_kreMCVoevf6hPTGmjdseKEp1dbL0Hu5l-y8oUAyh-p2wKZcxCQj6sNxcJrqBL2AQWrSkLXmBEB31GA" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><br>Because the goal here is to add a chatbot to an Android app, I'll skip the detailed instructions for building a chatbot. However, you can begin by reading our article "<a href="https://www.kommunicate.io/blog/how-to-make-a-chatbot/">How to Create a Chatbot</a>." for a step-by-step guide.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Adding Chatbot To Android App</h2>
<!-- /wp:heading -->

<!-- wp:heading {"level":3} -->
<h3>Prerequisites</h3>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li>Android 4.1 (API level 16) or higher</li><li>Java 7 or higher</li><li>Android Gradle Plugin 3.4.0 or higher</li></ul>
<!-- /wp:list -->

<!-- wp:heading {"level":3} -->
<h3>Installation&nbsp;</h3>
<!-- /wp:heading -->

<!-- wp:heading {"level":4} -->
<h4>Step 1: Adding gradle dependency to your App</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Launch Android Studio and open your project. If you're used to working with external libraries or SDKs, adding Kommunicate SDK is a breeze.<br><br>If you are using Gradle 6.7 or lower, add the following code to your root build.gradle file:</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>allprojects</strong> {</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>&nbsp;&nbsp;&nbsp;&nbsp;<strong>repositories</strong> {</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>maven</strong> { <strong>url</strong> 'https://kommunicate.jfrog.io/artifactory/kommunicate-android-sdk' }</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>}</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Copy</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If you are using Gradle 6.8 or higher, add the following to your settings.gradle file:</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>dependencyResolutionManagement</strong> {</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>&nbsp;&nbsp;&nbsp;&nbsp;<strong>repositories</strong> {</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>maven</strong> { <strong>url</strong> 'https://kommunicate.jfrog.io/artifactory/kommunicate-android-sdk' }</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>}</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Copy</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Next, for all Gradle versions, add the dependency to your module build.gradle file:</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>dependencies</strong> {</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>implementation</strong> 'io.kommunicate.sdk:kommunicateui:2.4.6'</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>}</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><br>Once the build sync is done, you have installed Kommunicate on your app and can proceed to the next step.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>Step 2: Initialize SDK</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>After the Gradle sync with the kommunicate dependency is complete, you can initialize the SDK by calling the following method:</p>
<!-- /wp:paragraph -->

<!-- wp:table -->
<figure class="wp-block-table"><table><tbody><tr><td><strong>Kommunicate.init(context, APP_ID);</strong></td></tr></tbody></table></figure>
<!-- /wp:table -->

<!-- wp:paragraph -->
<p><br>You can initialize the SDK in your Activity's onCreate() function. Just make sure it's initialized before calling any Kommuniate SDK methods. The APP_ID parameter will be set to the application id (APP ID) you just got from the <a href="https://dashboard.kommunicate.io/settings/install">Kommunicate dashboard</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":4} -->
<h4>Step 3: Initialize conversation with the created chatbot</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Kommunicate includes a ready-to-use Chat UI, so the only thing left to do in this step is to launch the chat screen.&nbsp;</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Here's how you can start the conversation:</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":11476,"sizeSlug":"full","linkDestination":"none"} -->
<div class="wp-block-image"><figure class="aligncenter size-full"><img src="https://www.kommunicate.io/blog/wp-content/uploads/2022/09/Screenshot-2022-09-16-at-10.30.58-PM.png" alt="" class="wp-image-11476"/></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Also, if you have a list of human agents and/or multiple bots and need to start a conversation with them, use the builder described below:</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":11477,"sizeSlug":"full","linkDestination":"none"} -->
<div class="wp-block-image"><figure class="aligncenter size-full"><img src="https://www.kommunicate.io/blog/wp-content/uploads/2022/09/Screenshot-2022-09-16-at-10.31.48-PM.png" alt="" class="wp-image-11477"/></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>You're finished! Launch the Android app and communicate with the chatbot. In a few simple steps, you can easily integrate a chatbot into your Android app. If you require any additional information, please review the <a href="https://docs.kommunicate.io/docs/android-installation">Kommunicate documentation</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Customization</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The ability to brand the look and feel of the chat UI as well as customize the colors, strings, and fonts is granted. Kommunicate includes simple settings for customizing different elements and enabling or disabling specific features.<br><br>To accomplish this, Essentially, the setting file must be downloaded and the properties modified.</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>Download the settings file from here (Right click -&gt; Save as -&gt; Save)</li><li>Place the downloaded applozic-settings.json file under your app/src/main/assets/ folder.</li></ul>
<!-- /wp:list -->

<!-- wp:heading {"level":4} -->
<h4>To change the background color&nbsp;</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Modify the hex color codes in the properties listed below in the applozic-settings.json file.</p>
<!-- /wp:paragraph -->

<!-- wp:table -->
<figure class="wp-block-table"><table><tbody><tr><td><strong>"sentMessageBackgroundColor": "#5c5aa7",</strong><strong>"receivedMessageBackgroundColor": "#e6e5ec",</strong><strong>"sentMessageCreatedAtTimeColor": "#ede6e6",</strong><strong>"receivedMessageCreatedAtTimeColor": "#8a8686",</strong><strong>"sentMessageTextColor": "#FFFFFFFF",</strong><strong>"receivedMessageTextColor": "#646262"</strong></td></tr></tbody></table></figure>
<!-- /wp:table -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh6.googleusercontent.com/0p3IFZzH8l4lWI5ExYZXlyw10vJYDJbsWEDkcQE1aKQhukLEiaTQRvSbWwksP7k6udfnzQXYezpgWbP9PvugrK89MEtQt3Zen11rEC1eWK514xFyQFK4E9u2KVgfQl6GEPO1Dw-SsFHj1yxIbv5kRY9Jeqr5vzeRMo7SWEdk3Pey1RonN2D8rpgzKA" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:heading {"level":4} -->
<h4>To change the attachment options&nbsp;</h4>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>By changing the values in the applozic-settings.json file, you can hide or show the media attachments options such as camera, emoji, files, and location sharing.</p>
<!-- /wp:paragraph -->

<!-- wp:table -->
<figure class="wp-block-table"><table><tbody><tr><td><strong>"attachmentOptions": {</strong><strong>&nbsp;&nbsp;&nbsp;&nbsp;":location": false, // Location sharing option will be disabled</strong><strong>&nbsp;&nbsp;&nbsp;&nbsp;":camera": true,</strong><strong>&nbsp;&nbsp;&nbsp;&nbsp;":file": true,</strong><strong>&nbsp;&nbsp;&nbsp;&nbsp;":audio":true</strong><strong>&nbsp;&nbsp;}</strong></td></tr></tbody></table></figure>
<!-- /wp:table -->

<!-- wp:image -->
<figure class="wp-block-image"><img src="https://lh4.googleusercontent.com/xhfKUjFv3VWkf2YXQBlJR7uWAX7ZcqJn-5RJj52kKV0XbrAAN6HlYc9EIjjp3vQ4TlG7D3fQk2pDcTG6Y8XVkyT0kdjfKVd_JI20Rgl07_fm2nGGxNi3rny2rqXZVyQYnwVG059LtAEIDlvd0Lgod3dsYPqdsLFtIvpe1wLw4nEwhAZYdzrvW4eclw" alt=""/></figure>
<!-- /wp:image -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">More customisation and configuration can be found in the kommunicate <a href="https://docs.kommunicate.io/docs/android-customization">documentation</a>. And this is how the bot's first-screen interaction should look.<br></p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":11480,"sizeSlug":"full","linkDestination":"none"} -->
<div class="wp-block-image"><figure class="aligncenter size-full"><img src="https://www.kommunicate.io/blog/wp-content/uploads/2022/09/Screenshot-2022-09-16-at-10.39.16-PM.png" alt="" class="wp-image-11480"/></figure></div>
<!-- /wp:image -->

<!-- wp:heading -->
<h2>Conclusion:&nbsp;</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Not only that, but if you want to develop your own chat implementation and directly integrate other bot platforms like Dialogflow, Amazon Lex, or custom bot into your Android app using Kommunicate SDK, you can do so.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Chatbots are the future of technology, and you can get a head start by adding a chatbot to your android app.</p>
<!-- /wp:paragraph -->