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.

Our pre-built chat UI

Our pre-built chat UI

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 Application Key in
app androidmanifest.xml with your Application Key in the following meta data:

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

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 and update the GCM/FCM server key under
Action -> Edit -> Push Notification -> 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.9'

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 androidmanifest.xml:

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

Add Permissions outside the application Tag <application>

<meta-data android:name="com.applozic.application.key"
           android:value="YOUR_APPLOZIC_APPLICATION_KEY" /> <!-- Applozic Application Key -->

<meta-data android:name="com.applozic.mobicomkit.notification.smallIcon"
           android:resource="YOUR_LAUNCHER_SMALL_ICON" /> <!-- Launcher white Icon -->

<meta-data android:name="main_folder_name"
           android:value="@string/default_media_location_folder" /> <!-- Attachment Folder Name -->

<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' -->

<provider
            android:name="com.applozic.mobicomkit.uiwidgets.ALFileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/applozic_provider_paths" />
 </provider>

If you are not using gradle build you need to replace ${applicationId} with your Android app package name

You need to define the attachment folder name in your string.xml file

<string name="default_media_location_folder">YOUR_APP_NAME</string>

Add the following permissions:

<uses-permission android:name="<APP_PKG_NAME>.permission.MAPS_RECEIVE" />
<permission android:name="<APP_PKG_NAME>.permission.MAPS_RECEIVE" android:protectionLevel="signature" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"  />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />

Add the below Activities, Services and Broadcast receiver :

<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" >
      <!-- Parent activity meta-data to support API level 7+ -->
<meta-data
           android:name="android.support.PARENT_ACTIVITY"
           android:value="<APP_PARENT_ACTIVITY>" />
 </activity>

 <activity android:name="com.applozic.mobicomkit.uiwidgets.people.activity.MobiComKitPeopleActivity"
           android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
           android:label="@string/app_name"
           android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
           android:theme="@style/ApplozicTheme"
           android:windowSoftInputMode="adjustResize">

            <!-- Parent activity meta-data to support API level 7+ -->
<meta-data android:name="android.support.PARENT_ACTIVITY"
           android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" />

         <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
         </intent-filter>

         <intent-filter>
               <action android:name="android.intent.action.SEND" />             
               <category android:name="android.intent.category.DEFAULT" />
               <data android:mimeType="image/*" />
               <data android:mimeType="audio/*" />
               <data android:mimeType="video/*" />
               <data android:mimeType="text/plain"/>
         </intent-filter>
<meta-data android:name="android.app.searchable"
           android:resource="@xml/searchable_contacts" />
</activity>

<activity android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.FullScreenImageActivity"
          android:configChanges="keyboardHidden|orientation|screenSize"
          android:label="Image"
 android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
          android:theme="@style/Applozic_FullScreen_Theme">
    <!-- Parent activity meta-data to support API level 7+ -->
<meta-data
          android:name="android.support.PARENT_ACTIVITY"
          android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" />
</activity>

<activity android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.ContactSelectionActivity"
          android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
          android:launchMode="singleTop"
          android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
          android:theme="@style/ApplozicTheme">
<meta-data
           android:name="android.support.PARENT_ACTIVITY"
           android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" />
</activity>

<activity android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.ChannelCreateActivity"
          android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
          android:launchMode="singleTop"
          android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
          android:theme="@style/ApplozicTheme">
<meta-data
          android:name="android.support.PARENT_ACTIVITY"
          android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" />
</activity>

<activity android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.ChannelNameActivity"
          android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
          android:launchMode="singleTop"
          android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
          android:theme="@style/ApplozicTheme">
</activity>

<activity android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.ChannelInfoActivity"
          android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
          android:launchMode="singleTop"
          android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
          android:theme="@style/ApplozicTheme">
  <meta-data
           android:name="android.support.PARENT_ACTIVITY"
           android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" />
 </activity>

<activity android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.MobiComAttachmentSelectorActivity"
          android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
          android:launchMode="singleTop"
          android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
          android:theme="@style/ApplozicTheme"
          android:windowSoftInputMode="stateHidden|adjustResize">
<meta-data 
           android:name="android.support.PARENT_ACTIVITY"
           android:value="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity" />
</activity>

<activity android:name="com.applozic.mobicomkit.uiwidgets.conversation.activity.MobicomLocationActivity"
          android:configChanges="keyboardHidden|screenSize|smallestScreenSize|screenLayout|orientation"
          android:parentActivityName="com.applozic.mobicomkit.uiwidgets.conversation.activity.ConversationActivity"
          android:theme="@style/ApplozicTheme"
          android:windowSoftInputMode="adjustResize">
 </activity>

<activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
          android:theme="@style/Base.Theme.AppCompat"/>


<service android:name="org.eclipse.paho.android.service.MqttService"/>

<service android:name="com.applozic.mobicomkit.api.conversation.MessageIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE"
         android:exported="false" />

<service android:name="com.applozic.mobicomkit.api.conversation.ApplozicIntentService"
         android:exported="false"
         android:permission="android.permission.BIND_JOB_SERVICE"/>
            
<service android:name="com.applozic.mobicomkit.api.conversation.ApplozicMqttIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE"
         android:exported="false" />

<service android:name="com.applozic.mobicomkit.api.people.UserIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE"
          android:exported="false" />

<service android:name="com.applozic.mobicomkit.uiwidgets.people.contact.DeviceContactSyncService"
            android:exported="false"
            android:permission="android.permission.BIND_JOB_SERVICE" />

<service android:name="com.applozic.mobicomkit.api.conversation.ConversationIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE"
         android:exported="false" />

<receiver android:name="com.applozic.mobicomkit.broadcast.TimeChangeBroadcastReceiver">
         <intent-filter>
             <action android:name="android.intent.action.TIME_SET" />
             <action android:name="android.intent.action.TIMEZONE_CHANGED" />
         </intent-filter>
</receiver>

<receiver android:name="com.applozic.mobicomkit.broadcast.ConnectivityReceiver"
          android:exported="true" android:enabled="true">
          <intent-filter>
              <action android:name="android.intent.action.BOOT_COMPLETED" />
          </intent-filter>
</receiver>

Replace APP_PARENT_ACTIVITY with your app's parent activity.

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.9'

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 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 application key (you will get the application key from Applozic Dashboard after signing up)

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.9'
}

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 27
    buildToolsVersion '27.0.2'
   
    defaultConfig {
        applicationId "you-package-name"
        minSdkVersion 14
        targetSdkVersion 27
        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.8.8'
  }
}

AndroidManifest

Applozic messaging needs following permissions to be added in your AndroidManifest file:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
//your other permissions go here

Permissions

Skip adding permission if you already have same permission present in your AndroidManifest.xml

Register the following services in your AndroidManifest file:

<service android:name="org.eclipse.paho.android.service.MqttService"/>

<service android:name="com.applozic.mobicomkit.api.conversation.MessageIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE"
         android:exported="false" />

<service android:name="com.applozic.mobicomkit.api.conversation.ApplozicIntentService"
         android:exported="false"
         android:permission="android.permission.BIND_JOB_SERVICE"/>
            
<service android:name="com.applozic.mobicomkit.api.conversation.ApplozicMqttIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE"
         android:exported="false" />

<service android:name="com.applozic.mobicomkit.api.people.UserIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE"
         android:exported="false" />

<service android:name="com.applozic.mobicomkit.api.conversation.ConversationIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE"
         android:exported="false" />

Register the following Broadcast Receivers in your AndroidManifest file:

<receiver android:name="com.applozic.mobicomkit.broadcast.TimeChangeBroadcastReceiver">
         <intent-filter>
             <action android:name="android.intent.action.TIME_SET" />
             <action android:name="android.intent.action.TIMEZONE_CHANGED" />
         </intent-filter>
</receiver>

<receiver android:name="com.applozic.mobicomkit.broadcast.ConnectivityReceiver"
          android:exported="true" android:enabled="true">
          <intent-filter>
              <action android:name="android.intent.action.BOOT_COMPLETED" />
          </intent-filter>
</receiver>

Add the following metadata in your AndroidManifest file:

<meta-data android:name="com.applozic.application.key"
           android:value="YOUR_APPLOZIC_APPLICATION_KEY" />
<meta-data android:name="main_folder_name"
           android:value="your-media-folder-name" /> <!-- Attachment Folder Name --

At the end your AndroidManifest file will look somewhat like this:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
//your other permissions go here

<service android:name="org.eclipse.paho.android.service.MqttService"/>

<service android:name="com.applozic.mobicomkit.api.conversation.MessageIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE"
         android:exported="false" />

<service android:name="com.applozic.mobicomkit.api.conversation.ApplozicIntentService"
         android:exported="false"
         android:permission="android.permission.BIND_JOB_SERVICE"/>
            
<service android:name="com.applozic.mobicomkit.api.conversation.ApplozicMqttIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE"
         android:exported="false" />

<service android:name="com.applozic.mobicomkit.api.people.UserIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE"
         android:exported="false" />

<service android:name="com.applozic.mobicomkit.api.conversation.ConversationIntentService"
         android:permission="android.permission.BIND_JOB_SERVICE"
         android:exported="false" />
<service
 android:name="com.applozic.mobicomkit.uiwidgets.people.contact.DeviceContactSyncService"
            android:exported="false"
            android:permission="android.permission.BIND_JOB_SERVICE" />

<receiver android:name="com.applozic.mobicomkit.broadcast.TimeChangeBroadcastReceiver">
         <intent-filter>
             <action android:name="android.intent.action.TIME_SET" />
             <action android:name="android.intent.action.TIMEZONE_CHANGED" />
         </intent-filter>
</receiver>

<receiver android:name="com.applozic.mobicomkit.broadcast.ConnectivityReceiver"
          android:exported="true" android:enabled="true">
          <intent-filter>
              <action android:name="android.intent.action.BOOT_COMPLETED" />
          </intent-filter>
</receiver>

<meta-data android:name="com.applozic.application.key"
           android:value="YOUR_APPLOZIC_APPLICATION_KEY" />
<meta-data android:name="main_folder_name"
           android:value="your-media-folder-name" /> <!-- Attachment Folder Name -->

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