close search

Getting started with Stringee Widget to make a video call from Mobile App to StringeeX Contact Center

Stringee Widget is the easiest way to quickly add video call to your mobile app. Stringee Widget provides a basic and non-customizable UI to make a video call from the mobile app to StringeeX Contact Center. To customize your UI and utilize advanced Stringee API features, you need to follow the tutorial here:

This tutorial walks you through the steps of using Stringee Widget.

Step 1:

Before you use Stringee Widget to make or receive a video call, you must sign up for a Stringee account. There're 2 ways to do it:

Option 1:
  1. Sign up a Stringee account on:
  2. Go to the Dashboard and Create a project

  3. Create a portal

  4. Generate an access token: Tools -> Generate Access Token

Option 2:
  1. Sign up a StringeeX account on:
  2. Create a portal

  3. Generate an access token: Sign in with the StringeeX account then go to Tools -> Generate Access Token

Step 2: Creating a new project

Stringee Call API is delivered in Stringee SDK which is designed to be used with Android Studio.

1. Open Android Studio and select New Project from the File menu.
2. Set the minimum SDK for the app to be API 16 (Android 4.1 Jelly Bean).
3. Click through the wizard, ensuring that Empty Activity is selected. Leave the Activity Name set to MainActivity and the Layout Name set to activity_main.

Step 3: Adding the Stringee SDK

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

  1. Navigate to your build.gradle at the project level and include the following:

    buildscript {
        repositories {
  2. Navigate to your build.gradle at the app level and include the following:

    android {
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
    dependencies {    
        implementation ''
        implementation ''
        implementation 'androidx.appcompat:appcompat:1.4.2'

Step 4: Permissions and proguard

The Stringee Android SDK requires some permissions from your app's AndroidManifest.xml file:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.VIBRATE" />

If your project uses ProGuard, you may have to add the following settings to the ProGuard configuration file to ensure Stringee builds correctly:

-dontwarn org.webrtc.**
-keep class org.webrtc.** { *; }
-keep class com.stringee.** { *; }

Step 5: Activities and services

You must declare some activities and services in your app's Manifest:


<service android:name="com.stringee.widget.RejectCallService" />

Step 6: Setting up authentication

In order to connect to Stringee Server, you will need access to the authentication credential: access token. In production application, the access token should be generated by your server described here: Client authentication.

But to speed things up, we will just hard code the value for now:

  1. In the MainActivity class, declare a variable to store the access token.
    public class MainActivity extends AppCompatActivity {
        private String token;
  2. Adjust the code by hard coding the value for the token with the access token generated in Step 1.

Step 7: Connecting

Next, we will connect to Stringee Server. You must do this before you can make or answer a video call.

  1. Add a StringeeWidget property to the MainActivity class.

    private StringeeWidget stringeeWidget;
  2. Instantiate the StringeeWidget object and register a connection listener to interact with the Stringee server:

    stringeeWidget.setListener(new StringeeListener() {
        public void onConnectionConnected() {
        public void onConnectionDisconnected() {
        public void onConnectionError(StringeeError stringeeError) {
        public void onRequestNewToken() {
        public void onCallStateChange(StringeeCall stringeeCall, StringeeCall.SignalingState signalingState) {
        public void onCallStateChange2(StringeeCall2 stringeeCall2, StringeeCall2.SignalingState signalingState) {
    • When the client connects to Stringee Server, the onConnectionConnected() method is called.
    • When the client disconnects to Stringee Server, the onConnectionDisconnected() method is called
    • When the client fails to connect to Stringee Server, the onConnectionError(StringeeError stringeeError) method is called.
    • When the token is expired, the onRequestNewToken() is called. You will need re-generate a new token and connect again.
  3. Connect the Stringee server with an access token generated in Step 5:


Step 8: Making a call

Before making a call, you need to learn about the flow of a call from mobile app to StringeeX Contact Center.

For more detail, go to When you create a portal in the Step 1, a Contact Center number is auto-generated. You can configure this number in your portal -> Settings -> Call Center -> Hotline.

Now you can make a call from your mobile app to the Contact Center:

  1. Initialize a call config:

    CallConfig callConfig = new CallConfig(from, to);
    • from: is the user id which is used to generate access token in Step 1.
    • to: is the Contact Center number, such as "testcall".
  2. Make call:

    stringeeWidget.makeCall(callConfig, new StatusListener() {
        public void onSuccess() {
        public void onError(StringeeError error) {
  3. Monitor the call state: When the client makes a video call successfully, the call will walk through many states such as calling, ringing, answered, ended, busy… Each time the call’s state changes, the onCallStateChange2(StringeeCall2 stringeeCall2, StringeeCall2.SignalingState signalingState) method is invoked.

Step 9: Answering a call

After the client connects Stringee Server, incoming calls is automatically handled by Stringee Widget. You do not need do anything. When you have an incoming call, Stringee Widget will show a notifcation or an incoming screen with pre-defined UI for you to answer or reject the call. To make a testing call from the Contact Center to your mobile app, go to your StringeeX portal, open the softphone, make a call to the user id which is used to generate access token in the Step 1.

Step 10: Running the app

Now that your code is complete, you can run the app with your device. You can view a completed version of this sample app on GitHub: