Chat APIs and In-app Messaging SDKs for Developers

Applozic provides Chat APIs and In-app Messaging SDKs for Android, iOS and Web apps to power cross-device, multi-platform rich messaging.
Find comprehensive guides and platform-specific Chat API documentation to get started with In-app Messaging.

Get Started    

Android

Install Applozic chat in Android

Pre-built customizable chat UI

This section will guide you in using our pre-built chat UI in your android app.

Alternatively, if you are looking to build your own chat UI using Applozic's features, you can refer to Build your UI from scratch section below.

Applozic sample chat app

You can try out the Applozic chat in our sample chat app: Applozic Sample App

You can also build your own app on top of our sample app. Just follow the steps mentioned below to get started:

1) Open the downloaded project in Android Studio, replace Applozic App ID in your
App's AndroidManifest.xml with your App ID in the below metadata tag. Your App ID can be found here---> App ID:

<meta-data android:name="com.applozic.application.key"
           android:value="<YOUR_APPLOZIC_APP_ID>" />

2) For enabling push notifications, you must have a Firebase account. Sign up to Firebase console and create your application with sample app package name
and generate push notification google json service file replace that in sample app under app folder.

Go to Applozic Dashboard Push Notification section and update the GCM/FCM server key under Android -> GCM/FCM Server Key


Adding Applozic to your existing application

Follow the steps mentioned below to integrate Applozic with pre-built chat UI with your existing application:

Gradle Dependency

Add the following in your build.gradle dependency:

implementation 'com.applozic.communication.uiwidget:mobicomkitui:5.51'

Add the following in gradle android target:

android {

        packagingOptions {           
           exclude 'META-INF/DEPENDENCIES'      
           exclude 'META-INF/NOTICE'         
           exclude 'META-INF/LICENSE'      
           exclude 'META-INF/LICENSE.txt'    
           exclude 'META-INF/NOTICE.txt' 
           exclude 'META-INF/ECLIPSE_.SF'
           exclude 'META-INF/ECLIPSE_.RSA'
         }    
    }

AndroidManifest

Add the following Permissions, Activities, Services and Receivers in your androidmanifest.xml:

Add meta-data, Activities within application Tag <application> </application>

If using tools:node="replace" tag for any component, metadata or permissions, make sure to define the tag within your </manifest> tag as:
xmlns:tools="http://schemas.android.com/tools"

Add the below metadata:

<meta-data android:name="com.applozic.application.key"
           android:value="<YOUR_APPLOZIC_APP_ID>" /> <!-- Replace with your Applozic App ID -->

<meta-data android:name="com.applozic.mobicomkit.notification.smallIcon"
           android:resource="<YOUR_LAUNCHER_SMALL_ICON>" /> <!-- Replace this with a valid resource name for Launcher white Icon -->

<meta-data android:name="main_folder_name"
           android:value="<YOUR-FOLDER-NAME>" 
           tools:node="replace"/> <!-- If you do not set this tag then by default the attachment folder name would be Applozic. Thats why we are using replace node-->

<meta-data android:name="com.google.android.geo.API_KEY"
           android:value="<YOUR_GEO_API_KEY>" />  <!--Replace with your geo api key from google developer console  --> 
<!-- For testing purpose use AIzaSyAYB1vPc4cpn_FJv68eS_ZGe1UasBNwxLI
To disable the location sharing via map add this line ApplozicSetting.getInstance(context).disableLocationSharingViaMap(); in onSuccess of Applozic UserLoginTask -->

 <meta-data android:name="activity.open.on.notification"
 android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" /> <!-- NOTE : Do NOT change this value -->    

 <meta-data android:name="com.package.name" 
           android:value="${applicationId}" /> <!-- NOTE: Do NOT change this, it should remain same i.e 'com.package.name' -->

Add the below Activity :

<activity android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
           android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
           android:label="@string/app_name"
           android:parentActivityName="<APP_PARENT_ACTIVITY>"
           android:theme="@style/ApplozicTheme"
           android:launchMode="singleTask"
           tools:node="replace">
      <!-- Parent activity meta-data to support API level 7+ -->
<meta-data
           android:name="android.support.PARENT_ACTIVITY"
           android:value="<APP_PARENT_ACTIVITY>" />
 </activity>

Replace APP_PARENT_ACTIVITY with your app's parent activity.

You final AndroidManifest file should look something like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.mobicomkit.sample"
    android:versionCode="1"
    android:versionName="1.0">

    <application
        android:name=".MainApplication"
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        
      <activity
            android:name=".MainActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
            android:label="@string/app_name"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"         android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
            android:label="@string/app_name"
            android:launchMode="singleTask"
            android:parentActivityName="com.mobicomkit.sample.MainActivity"
            android:theme="@style/ApplozicTheme"
            tools:node="replace">
            <!-- Parent activity meta-data to support API level 7+ -->
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.mobicomkit.sample.MainActivity" />
        </activity>

        <meta-data
            android:name="com.applozic.application.key"
            android:value="<Your-App-Id>" /> <!-- Replace with your Applozic App ID -->

        <meta-data
            android:name="com.applozic.mobicomkit.notification.smallIcon"
            android:resource="@mipmap/ic_launcher" /> <!-- Replace this with a valid resource name for Launcher white Icon -->

        <meta-data
            android:name="main_folder_name"
            android:value="<Your-Main-Folder-Name>"
            tools:node="replace" />

        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="AIzaSyAYB1vPc4cpn_FJv68eS_ZGe1UasBNwxLI" />  <!--Replace with your geo api key from google developer console  -->
        <!-- For testing purpose use AIzaSyAYB1vPc4cpn_FJv68eS_ZGe1UasBNwxLI
        To disable the location sharing via map add this line ApplozicSetting.getInstance(context).disableLocationSharingViaMap(); in onSuccess of Applozic UserLoginTask -->

   <meta-data
 android:name="activity.open.on.notification"
 android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" /> <!-- NOTE : Do NOT change this value -->

        <meta-data
            android:name="com.package.name"
            android:value="${applicationId}" /> <!-- NOTE: Do NOT change this, it should remain same i.e 'com.package.name' -->
    </application>
</manifest>

ProGuard Setup

Add the following if you are using ProGuard:

 #keep json classes                
 -keepclassmembernames class * extends com.applozic.mobicommons.json.JsonMarker {
     !static !transient <fields>;
 }

 -keepclassmembernames class * extends com.applozic.mobicommons.json.JsonParcelableMarker {
     !static !transient <fields>;
 }
 #GSON Config          
-keepattributes Signature          
-keep class sun.misc.Unsafe { *; }           
-keep class com.google.gson.examples.android.model.** { *; }            
-keep class org.eclipse.paho.client.mqttv3.logging.JSR47Logger { *; } 
-keep class android.support.** { *; }
-keep interface android.support.** { *; }
-dontwarn android.support.v4.**
-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**
-keep class com.google.gson.** { *; }

Third party libraries used

Applozic UI uses couple of libraries to build the chat UI. If you are using the same libraries in your application, you can avoid adding them to your project and access the same libraries from applozic.
To be able to access the libraries you need to import applozic sdk using api instead of implementation.
Add the below line in your app level build.gradle file's dependency:

api 'com.applozic.communication.uiwidget:mobicomkitui:5.51'

Below are the list of libraries used in the Applozic SDK:

implementation 'de.hdodenhof:circleimageview:2.2.0' //for circular images
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'//for image cropping
implementation 'com.github.bumptech.glide:glide:4.7.1' //for loading images
implementation 'com.android.support:cardview-v7:27.1.1' //card view library
implementation 'com.android.support.constraint:constraint-layout:1.1.2'//constraint layout
api 'com.google.code.gson:gson:2.8.5' //JSON parsing library
api 'com.google.firebase:firebase-messaging:17.1.0'//for FCM notification 
api 'com.google.android.gms:play-services-maps:15.0.1'//for google maps 
api 'com.google.android.gms:play-services-location:15.0.1'//for location services


Build your UI from scratch

Building a messaging application with Applozic is very simple. We provide APIs which you can use to build your own UI from scratch

Setting it up

Let's start with the Installation part.

First, Install and Initialise the SDK with the App ID (you will get the App ID from Applozic Dashboard after signing up from install section here)

Custom UI Sample App

You can check out this Custom UI sample app which can be used as a reference. Also, you can clone it and try locally.

Gradle Dependency

To use Applozic Android SDK you need to add the following dependency in your app level (Not project level) build.gradle file:

dependencies {
   //your other dependencies go here
    compile 'com.applozic.communication.message:mobicomkit:5.51'
}

Add the following packaginOptions in your app level build.gradle file inside android tag:

packagingOptions {
        //Your other packaging options go here
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/ECLIPSE_.SF'
        exclude 'META-INF/ECLIPSE_.RSA'
    }

Your app level build.gradle file will look somewhat like this:

buildscript {
 android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
   
    defaultConfig {
        applicationId "you-package-name"
        minSdkVersion 14
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
   
    packagingOptions {
      //Your other packaging options go here
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
        exclude 'META-INF/ECLIPSE_.SF'
        exclude 'META-INF/ECLIPSE_.RSA'
    }
}

dependencies {
   //your other dependencies go here
    compile 'com.applozic.communication.message:mobicomkit:5.51'
  }
}

AndroidManifest

Add the following metadata in your AndroidManifest file:

<meta-data android:name="com.applozic.application.key"
           android:value="<YOUR_APPLOZIC_APPLICATION_ID>" />
<meta-data android:name="main_folder_name"
           android:value="<your-media-folder-name>" /> <!-- Attachment Folder Name -->
<meta-data android:name="activity.open.on.notification"
            android:value="<Your-Chat-Activity>" />

Proguard Setup

If you are using proguard in your application, you need to add the below lines in your proguard-rules.pro file:

#keep json classes                
 -keepclassmembernames class * extends com.applozic.mobicommons.json.JsonMarker {
     !static !transient <fields>;
 }

 -keepclassmembernames class * extends com.applozic.mobicommons.json.JsonParcelableMarker {
     !static !transient <fields>;
 }
 #GSON Config          
-keepattributes Signature          
-keep class sun.misc.Unsafe { *; }           
-keep class com.google.gson.examples.android.model.** { *; }            
-keep class org.eclipse.paho.client.mqttv3.logging.JSR47Logger { *; } 
-keep class android.support.** { *; }
-keep interface android.support.** { *; }
-dontwarn android.support.v4.**
-keep public class com.google.android.gms.* { public *; }
-dontwarn com.google.android.gms.**
-keep class com.google.gson.** { *; }

Thats all the setup you need to start using Applozic Android APIs and build your very own Real time messaging application.

What's Next

Authentication

Android


Install Applozic chat in Android

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.