Tutorials
Documents
Tutorials Documents

How to setup eRTC for the 1st time

Running the demo project

This is great way to test the features of the eRTC SDK before you start integrating it with your app.

  • Clone eRTC SDK.
  • Run pod install in the Xcode directory.
  • Open the eRTC SDK eRTCSample.xcworkspace file in Xcode.
  • Compile and run.

Adding the Chat SDK to your project

This is great way to test the features of the eRTC SDK before you start integrating it with your app.

  • Add the eRTC SDK development pods to your Podfile.
    use_frameworks!
           pod “eRTCSDK”
  • Run pod install to get the latest version of the code.
  • Run pod update to get the latest version of the code (optional for pod update).
  • Open the App Delegate add the following code to initialise the chat

Objective C

AppDelegate.m -> application: didFinishLaunchingWithOptions:

#import <eRTC/eRTCSDK.h>

Add the following code to the start of your didFinishLaunchingWithOptions function:

[eRTCSDK initialise];

How to Add the eRTC Client SDK to your Android App

Gradle

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

Android X

Make sure you've added the following to your gradle.properties file.

android.useAndroidX=true

Initializing the Chat SDK

Now open your applications's main class and find the onCreate method. Add the following to setup the Chat SDK:

try {
   val config = Configuration.Builder()

   // SDK initialize
   eRTCSDK.initializeWithConfig(this, config.build());

} catch (ChatSDKException e) {
   // Handle any exceptions
   e.printStackTrace();
}

How to Send Chat 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 message over that thread ID.
To do that :

/*
Here user.id corresponds to the id of the user, you need to initiate chat with. Create Thread method takes two params, one is thread name and the second one is user id
*/

eRTCSDK.chat().createThread("", user.id);
//use the thread id created from above to start text messaging
String textMessage = “This is a text message”;
eRTCSDK.chat().sendMessage(textMessage, threadID);