In-App Chat Android SDK


eRTC SDK is secure, easy to integrate, deploy and manage.

The following principles are followed during development:

  • Modularity: Code is segregated into multiple modules and follows chain of responsibility model
  • Ease of Integration: Maven artifacts can be downloaded from a public hosted url. eRTC SDK can be integrated into any mobile app within minutes
  • Scalability: SDK is highly scalable and can support Enterprise traffic
  • Built on Latest Tech Stack
  • Data ownership: SDK provides a data layer to effectively manage and control data
  • Firebase powered by Google: Highly reliable and scalable
  • Reactive using RxAndroid


  • Individual messages
  • Push notifications
  • Text, Image, Video, Audio messages
  • Typing Indicators
  • Delivered and Read receipts
  • Chat history
  • Chat user list
  • Contact details


  • To start with an existing app, just initialize the SDK in your Application’s onCreate() method and start using the SDK features
  • Please note that we are using Java 8 in our SDK, sso you'll need to add Java 8 support in the compile options
  • We are using AndroidX in our SDK, so please add AndroidX support in
  • Once you do these prerequisites, you are ready to start using our SDK

API documentation

Validate the namespace of your app

   Consumer { this.success(it) }, error

Log in with username and password

login(AccountDetails details);
E.g. :-
eRTCSDK.tenant().login(AccountDetails.username(username, password)).subscribe(
Consumer { this.success(it) }, error

Forgot password

   Consumer { this.success(it) }, error

Change password

eRTCSDK.tenant().changePassword(AccountDetails.changePwd(oldPassword, newPassword)).subscribe(
   Consumer { this.success(it) }, error

To initiate chat, you have to create a thread with the recipient"testthread",
//testhread is thread name, you can choose to not provide

Code example:

//open chat screen to begin chatting
}, {
//handle error

Sending a text message

API signature : sendMessage(String text, String threadId);

String textMessage = “Hi!! What are you up to”;, threadID);

Sending a media message

sendMedia(String mediaPath, String threadId, String mediaType)
//mediaType = ‘image’/’audio’/’video’
filePath,             //filePath
messageRecord.msgType          //msgType = ’image’/’audio’/’video’

Code example:

For capturing photos:
Create a file_paths.xml file in res>xml folder, and add the content :-

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="">
<external-path name="external_files"
   path="." />

And in AndroidManifest.xml, add this under application tag


To get file for startTakePhotoActivity, use this

fun getPhotoImageFile(): File {
var cameraImage:File? = null
val mediaSelector = MediaSelector()
cameraImage = mediaSelector.getPictureFile()
return cameraImage;

fun capturePhoto(activity: Activity, cameraImage: File, requestCode: Int) {
    .onAllGranted {
       val mediaSelector = MediaSelector()
       mediaSelector.startTakePhotoActivity(activity, cameraImage)

Choose photos

fun selectGallery(activity: Activity, requestCode: Int) {


   .onAllGranted {
      val mediaSelector = MediaSelector()

Load user list

getUsersInSync(tenantId: String, lastId: String?)

E.g : Code below:

   this::onUserListSuccess,      //handle user list success
   this::onUserListError      //handle user list failure

private fun onUserListSuccess(userList: List) {

private fun onUserListError(throwable: Throwable) {

How to add the eRTC SDK to your Android app

Integration with an existing project is simple. You can add the core libraries using Gradle.


To download the SDK, you will need to include the repository manually:

  • Add repository
    repositories {
       maven { url "" }
  • Then add this to your dependencies area:
    implementation 'com.ripbull.ertcsdk:coreSdk:1.0.0'
       transitive = true
  • You also need to enable Java 8
    compileOptions {
       sourceCompatibility JavaVersion.VERSION_1_8
       targetCompatibility JavaVersion.VERSION_1_8

Android X

Make sure you’ve added the following to your file.


Initializing the Chat SDK

Now open your application’s main class and find the onCreate method. Add the following to set up the Chat SDK:

try {
// set your api key here
val config =

// SDK initialize

} catch (Exception e) {
   // Handle any exceptions

Sending a text message

A chat between two users is considered as a thread of communication. To initiate chat between users, you need to create threads and send messages over that thread ID.

To do that:

Creating threads for chat

Here corresponds to the ID of the user you need to initiate chat with.

createThread method takes two params, one is thread name and the second is user ID."",;

Send chat message

User the thread ID created above to start text messaging.

String textMessage = “This is a text message”;, threadID);

Block/unblock a user

To block a user: action = “block”
To unblock a user: action = “unblock”, user!!.id).subscribeOn(
//user is blocked/unblocked depending upon the action passed

}, { it.printStackTrace() })

Viewing blocked users
//check user.isBlocked to see if a particular user is blocked post this api call
}, { it.printStackTrace() })

How to handle permissions

implementation 'com.ripbull.ertcsdk:permissions:1.0.0@aar'

How to handle permissions

implementation 'com.ripbull.ertcsdk:coreAttachment:1.0.0@aar'

Sending a media message
Message,         //filePath
messageRecord.msgType      //msgType = ’image’/’audio’/’video’

Sending a document

   threadID, message,
   }, { it.printStackTrace() })

Sending a contact

}, { it.printStackTrace() }))

Sending a location

   }, { it.printStackTrace() })

Sending a GIF

    threadID, message
   }, { it.printStackTrace() })



  • Core SDK module
  • Permission module
  • Attachment module
  • Data Module
  • MQTT module
  • Analytics module
  • Core Http Module (Rest APIs)
  • Core Encryption
In-App Chat Android