Native Android SDK

REVE Chat’s Android SDK can be seamlessly integrated with your mobile apps and enable your team to deliver in-app messaging to your app users for better engagement and customer support.

This documentation shows you how to embed REVE Chat Android SDK in an Android application and get started in a few minutes.

Minimum Requirements

  1. Android Studio

  2. Minimum SDK version should be 14 or above

  3. SDK version (Compile, Build, Target) should be 26 or above

  4. SDK Version: 3.1.5

Android SDK Integration Process

Step 1

To integrate Android SDK with your mobile app, please follow the below mentioned steps. Based on gradle version follow either steps in (a) or (b)

  1. If gradle version is ( 7.X to 8.0 ) , add following repositories in project gradle file ( build.gradle )

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
        mavenLocal()
        google()
        maven {
            url "https://maven.iptelephony.revesoft.com/artifactory/libs-release-local/"
        }
        maven {// for revesoft cpp
            url "https://jfrog-artifact.revechat.com/artifactory/artifactory/"
        }
        maven { url "https://jitpack.io" }
    }
}
  1. If gradle version is 8.X to latest, add following repositories in settings.gradle

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
        maven { url 'https://maven.google.com/' }
        maven {
            url "https://jfrog-artifact.revechat.com/artifactory/artifactory/"
        }
        maven {
            url "https://maven.iptelephony.revesoft.com/artifactory/libs-release-local/"
        }
    }
}

Step 2

Add Design support library and REVE Chat Android SDK as dependency in your App level build.gradle file :

buildFeatures {
       dataBinding  true
       viewBinding true
   }


dependencies {
   implementation('com.revesoft.revechatsdk:revechatsdk:3.1.5')
}

Step 3

Add following lines from where you want to start the chat. However, this step needs to be done differently for JAVA or KOTLIN in separate ways.

Code for JAVA

private void startChat() {
//Initializing with account id

ReveChat.init("account id");

LoginState loginState = LoginState.LOGGED_OUT;

boolean doNotShowPreChatForm = true;

/**
* if application don't need to show pre-chat form then need to set as
* loginState = LoginState.LOGGED_IN
*/

if (doNotShowPreChatForm)

 loginState = LoginState.LOGGED_IN;

//Creating visitor info

VisitorInfo visitorInfo = new VisitorInfo.Builder()

				.name("your name")
				.email("your@email.com")
				.phoneNumber("your number")
				.appLoginState(loginState)
				.build();


//Set visitor info

ReveChat.setVisitorInfo(visitorInfo);

//Optional
//If want to Receive push notification from Reve Chat.
//Add your device token id(registration Id)
//You also need to do step 4.

ReveChat.setDeviceTokenId("deviceTokenId");

//starting chat window
startActivity(new Intent(this, ReveChatActivity.class));
startService(new Intent(this, REVEChatApiService.class));
}

Code for KOTLIN

private fun startChat() {
ReveChat.init("account id")

var loginState : LoginState = LoginState.LOGGED_OUT

var doNotShowPreChatForm = true 

/**
* if application don't need to show pre-chat form then need to set as
*      loginState = LoginState.LOGGED_IN

*/

if (doNotShowPreChatForm)

 loginState = LoginState.LOGGED_IN

//Creating visitor info

val visitorInfo: VisitorInfo = VisitorInfo.Builder()

               .name("your name")
               .email("your@email.com")
               .phoneNumber("your number")
               .appLoginState(loginState)
               .build()

//Set visitor info

ReveChat.setVisitorInfo(visitorInfo)

//Optional
//If want to Receive push notification from Reve Chat.
//Add your device token id(registration Id)
//You also need to do step 4.

ReveChat.setDeviceTokenId("deviceTokenId")

//starting chat window

startActivity(Intent(this, ReveChatActivity::class.java))
startService(Intent(this, REVEChatApiService::class.java))
}

Step 4

Stop REVEChatApiService from MAIN/LAUNCHER Activity’s onDestroy() method

// for Java

@Override
protected void onDestroy() {
       super.onDestroy();
       if (!WebRTCHandler.INSTANCE.isWebRTCCallRunning())
           stopService(new Intent(this, REVEChatApiService.class));
   }


// for Kotlin

override fun onDestroy() {
       super.onDestroy()
       if (!REVEChatApiService.isCallRunning())
           stopService(Intent(this, REVEChatApiService::class.java))

   }

Step 5

In the gradle.properties file add following lines

android.useAndroidX=true
android.enableJetifier=true

Step 6

Proguard Configuration

In your proguard configuration file add below:


-keep class org.webrtc.** { *; }
-keep class org.webrtc.voiceengine.** { *; }
-dontwarn org.webrtc.**

-keep class com.revesoft.revechatsdk.**{*;}
-keep interface com.revesoft.revechatsdk.* { *; }
-keep enum com.revesoft.revechatsdk.* { *; }
-dontwarn com.revesoft.revechatsdk.**

# Preserve generic type information for Gson
-keepattributes Signature

# Keep all classes and fields with generic types
-keepclassmembers,allowobfuscation class * {
    *;
}

# Keep Gson type adapters and serializers/deserializers
-keep class * extends com.google.gson.TypeAdapter
-keep class * extends com.google.gson.JsonSerializer
-keep class * extends com.google.gson.JsonDeserializer

# Keep any classes that use Gson with generics
-keep class * {
    @com.google.gson.annotations.SerializedName <fields>;
}

Step 7

Need to add below permissions in AndroidManifest.xml file

    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
    <uses-permission android:name="android.permission.MANAGE_OWN_CALLS" />
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />

GitHub sample application Link: AndroidReveChatSDKTestApp

Last updated

Was this helpful?