Using Android SDK

This guide provides you to make the simplest application to make audio calls. You can download/clone the application example using the following link: Demo project.

Android SDK has two dependencies: okhttp and gson. It also applies to the compat-versions which appeared since version 2.2.0. You can check the levels of dependencies according to the Android SDK version directly in the Maven. Note that there could be a delay between the last release and appearance in Maven’s searching index.


Adding SDK to your application

  • IMPORTANT: If you use version before 2.1.2, please remove all and .aar files from your project
  • Modify build.gradle file that is located at the root level of your project to add mavenCentral() to repositories list:
    allprojects {
       repositories {
           mavenCentral() //add this line
  • Edit build.gradle and add voximplant-sdk as compile files target in dependencies section. Paste the actual version from the changelog:
    dependencies {
       // Paste the actual version from the changelog
       implementation 'com.voximplant:voximplant-sdk:2.12.0'
  • Since version 2.5.0, it is required to add Java 8 support to your project in build.gradle file:
    android {
    ... //other configs
    compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8

Initializing SDK

Your application will require following permissions. They will be automatically merged to AndroidManifest by adding Android SDK as compile dependencies. You can also set them manually if you are using different build system.

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Bear in mind that CAMERA and RECORD_AUDIO permissions need to be prompted to a user since Android 6.0 (use the Voximplant.getMissingPermissions method to see the permissions that are not granted by the user).

Create the new singletone of type IClient and initialize it as specified in documentation:

IClient client = Voximplant.getClientInstance(
   new ClientConfig());


Logging in

Then you need to connect to the cloud and authorize the user. The IClient.connect (it is similar to Web SDK initialization) and IClient.login methods handle with it. You also have to set the appropriate listeners to handle with the connection and authentication results: IClientSessionListener and IClientLoginListener. For example, you can connect to the cloud and login user myuser to application myapp in your Voximplant account named myaccount with password mypass:

public class SomeClass implements IClientSessionListener,
       IClientLoginListener {
   private IClient client;

   // ctor and other logic here
   // Note: you also need to implement other methods from
   // IClientLoginListener and IClientSessionListener

   public void onConnectionEstablished() {
       Log.i(TAG, "Connection established");
       // For other login methods please see the article:
       client.login("", "mypass");

   public void onLoginSuccessful(String displayName,
                                 AuthParams authParams) {
       Log.i(TAG, "Login succeeded");

   public void connectToVoximplant() {


Making calls

Use IClient.callTo and ICall.start methods to initiate an outgoing call. To inspect the call conditions you have to be able to catch call events - for this purpose set the ICallListener via ICall.addCallListener.

boolean isVideo = false;  //will use it later to disable video for audio calls
String customData = null;
VideoFlags videoFlags = new VideoFlags(isVideo, isVideo);
ICall call = client.callTo(clientNumber, videoFlags, customData);
Map<String, String> headers = null;


Receiving calls

You have to set listener IClientIncomingCallListener to handle with an Incoming call. When an application receives an incoming call, onIncomingCall method is called. Use the ICall.answer method to answer a call:

public void onIncomingCall(ICall call, boolean hasIncomingVideo, Map<String, String> headers) {
   String customData = null;
   Map<String, String> headers = null;
          new VideoFlags(hasIncomingVideo, hasIncomingVideo), 


Terminating calls

Using the ICall.hangup method allows to terminate the call properly. Both participants will receive the ICallListener.onCallDisconnected event after hangup's call will be executed.

Map<String, String> headers = null;