Instructions to build 1-1 video calling application on Android platform with Stringee Call API

Tram Ho

Stringee Call API Overview

Stringee Call API is the easiest way to build high-quality voice applications in the Cloud. With Stringee’s Call API, you can:

Build apps that scale with web technologies of your choice. Buy a mobile phone number. Extend your infrastructure with SIP Interfaces. Control the flow of calls in JSON with the Stringee Call Control Object. (SCCO): Make an app-to-app call (peer-to-peer call) OR an app-to-phone call (outgoing call). Receive and manage phone calls (incoming calls): transfer calls to the app, reject calls, record, etc. Record and store calls. Create a conference call.


Before you can use the Stringee Call API to make and receive video calls, you need:

  1. Create a free Stringee account <a href = target = “_blank”>here</a>.
  2. Create project on <a href = target = “_blank”>Stringee Dashboard</a>


  1. Configure answer_url
  • To better understand answer_url , you can see <a href = target = “_blank”>here</a> .You can refer to how to create answer_url <a href = target = “_blank”>here</a>
  • To be able to make calls you need to configure the answer_url in your project as follows:


If you don’t already have an answer_url available, you can use the following Project’s answer_url to speed up the process:

(Source code: ) When building the app, you should have your own answer_url.

Stringee SDK integration


  1. Create an Android project with minSdkVersion >= 16.
  2. Create class MainActivity as main screen to make connection to Stringee Server.
  3. Create class CallActivity to display the screen of the call.

Install Stringee SDK

The Stringee Android SDK is distributed as an AAR and can be added to your project by referencing the AAR remotely with Maven.

  1. Open the build.gradle file and add the following lines:
  2. Open the app/build.gradle file and add the following lines:

Edit Permissions and proguard


Stringee Android SDK requires some permissions, open the AndroidManifest.xml file and add the following lines:


  • You are required to grant sufficient permissions before making a call, before making a call you are required to request the following permissions: RECORD_AUDIO, CAMERA
  • With using StringeeAudioManager class you need to grant BLUETOOTH_CONNECT permission for Android SDK version 31 and above


If your project uses ProGuard, you need to add the following settings to the file to ensure that the Stringee SDK release can run correctly:

Connect Stringee server

To connect to Stringee Server, you need access_token . During application building, the access_token should be generated from your server, you can learn more about authentication here: <a href = target = “_blank”>Client authentication</a>), and sample code to generate access_token : .

To save time, we will hard code the access_token in the app:

  1. In the MainActivity class, initialize a variable to hold the access_token .
  2. Get access_token and hard code data: To do that, we have provided a tool to generate access_token , you access <a href = ​​target = “_blank”> Dashboard -> Tools -> Generate Access token</a> and generate your access_token .

Next, we will connect to the Stringee Server . You need to be able to connect to the Stringee Server first before you can make calls.

  1. Add StringeeClient object to MainActivity class.
  2. Instantiate StringeeClient object and listen for events from StringeeConnectionListener to communicate with Stringee Server :
  • When the client successfully connects to the Stringee Server , the onConnectionConnected(StringeeClient stringeeClient, boolean isReconnecting) function is called.
  • When the client loses connection to the Stringee Server , the onConnectionDisconnected(StringeeClient stringeeClient, boolean isReconnecting) function is called.
  • When the client fails to connect to the Stringee Server , the onConnectionError(StringeeClient stringeeClient, StringeeError stringeeError) function is called.
  • When the access_token expires, the onRequestNewToken(StringeeClient stringeeClient) function is called. You will need to regenerate a new access_token and reconnect.
  • When the client receives an incoming call, here we use the StringeeCall2 object to make the video call, so the onIncomingCall2(StringeeCall2 stringeeCall2) function is called.
  1. If you use On-Premise Server , you need to add the following lines to be able to connect:
  • ip: ip of your server in String.
  • port: your server’s port is int.

Note: You need to setHost before connecting.

  1. Connect to Stringee Server using the access_token generated above:

Handle call logic

After connecting to Stringee Server , you need to do the following steps:

  1. Add the stringeeCall2 object to the CallActivity class:
  2. Listen for the event of the call:
  • When the call generation/response fails, the onError(StringeeCall stringeeCall, int code, String description) function is called.
  • When creating/answering a successful call, the call will go through many states such as: CALLING , RINGING , ANSWERED , ENDED , BUSY . Each time the state of the call changes, the function onSignalingStateChange(StringeeCall call, StringeeCall.SignalingState signalingState, String reason, int sipCode, String sipReason) is called.
  • When the call’s media stream connects or loses connection, the onMediaStateChange(StringeeCall stringeeCall, StringeeCall.MediaState mediaState) function is called.
  • When the call is handled on another device, the onHandledOnAnotherDevice(StringeeCall stringeeCall, StringeeCall.SignalingState signalingState, String description) function is called.
  • A call is actually successful when the media ‘s state is MediaState.CONNECTED .

Make an outgoing call

To make an outgoing call you need to do the following steps:

  1. Initialize stringeeCall2 :
  • client: The StringeeClient object has been initialized and used to connect to the previous Stringee Server . Make sure you have successfully connected to the Stringee Server and are still keeping the connection.
  • from: id of the caller.
  • to: is of the receiver.
  • Default is voice call so if you want to initiate a video call you need to call** setVideoCall(true)** before calling makeCall() and after initializing StringeeCall2 .
  1. Make a call:

Answer the call

To be able to answer an incoming call, follow these steps:

  1. Handle receiving calls in onIncomingCall2(StringeeCall2 stringeeCall2) function of StringeeConnectionListener .

    Store stringeeCall2 into a HashMap() object with callId key. Then send the callId of the call to the CallActivity class.
  2. Assign StringeeCall2 from callsMap :
  3. Send RINGING signal:Like initiating a call, we need to listen to the events of the call
  4. Answer and initiate a call:

Show videos

Stringee Android SDK exposes the video of the caller and receiver as a View object. You can add them as children of a ViewGroup object in the application. In the sample, we use the FrameLayout object as the container for the video of the caller and the receiver:

  1. Open the file app/res/layout/activity_call.xml and add the following lines:
  2. Declare vLocal and vRemote in the CallActivity class.
  3. Show video:After receiving the onLocalStream(StringeeCall2 stringeeCall2) event, we can add our video to vLocal :

    Similar to onLocalStream , we can add the other party’s video to vRemote after receiving the event onRemoteStream(StringeeCall2 stringeeCall2) :

    Adding the view of the video needs to be done in the background UI thread in order to communicate with UI components.

Some features in the call

Stop the call

Stop the call and release its resources:

Rejected calls

Rejected calls:


Mute your voice:

Switch speaker

Switch between internal and external speakers using StringeeAudioManager :

Change camera

Change the front and back of your camera:

Video On/Off

Video On/Off:

Run the app

Now your app can run on the device. You can refer sample full version <a href= target=”_blank”>here</a>


Above is a guide to build a 1-1 video calling application on the Android platform with Stringee Call API. Hopefully you can set up a video calling application by yourself following Stringee’s instructions. Also you can learn how to build video calling app on iOS platform <a href = -with-Stringee-Call-API target = “_blank”>here</a>).

Share the news now

Source : Viblo