Make a Video Call with Android SDK

Android SDK Integration Architecture

The Android SDK is a fast and effective way to include a live video chat in a mobile application. The SDK makes it easy to embed one to one, many to many high-quality voice and video calls into your mobile app, with a seamless integration with the Android/iOS operating system. It features a fully fledged set of collaborative tools comprehensive of: messaging, screen sharing, remote snapshot, collaborative interactive board and call recording capabilities.

The following diagram represents the most common integration layout of the Mobile SDK and the section following the diagram elaborates on the flow:



The access token used by the SDK is obtained on the server side. This implementation ensures that the apiKey is not shared publicly, and the access token is bound to the user session on the integrated website.

Using the apiKey on the client side is strongly discouraged and should be absolutely avoided in production.

1. Authenticate User

The user accesses the application by leveraging an authentication method of choice. User authentication is done externally from Kaleyra Video.

2. Obtain Access Token

To access Kaleyra SDK services an access token is required.

This operation is usually done in the context of user authentication so that the access token is returned to the client along with the user information. Alternatively, it can be retrieved at a later time. This is an implementation choice.

A back-end service needs to call the API Generate SDK Credentials passing the following payload and using the appropriate userId.

   "user_id": "user id",
   "expires_in": 3600
    "expires_at": "2022-01-10T11:41:19.000Z",
    "user_id": "user_xxx"


Access Token Expiration

A refresh policy for the token may be needed to ensure a smooth experience for the user.

The expires_in parameter represents the access tokenโ€™s expiration time expressed in seconds. It must be chosen within a range between 360 (6 minutes) and 86400 (24 hours).

3. Add SDK

// add maven repository
allprojects {
    repositories {
        maven { url '' }

// add dependency
implementation "com.bandyer:bandyer-android-sdk:$latestVersion"

You can find the latest released version here:

4. Video call

You can make a basic integration of the SDK for testing purposes by simply copy-pasting the following snippet of code.

Set userId, appId, region and environment variables as indicated in the following code:

val userId = "user id"
val appId = "app id associated to your account starts with mAppID"
val region = Eu // region to which your account belongs: eu, in or us
val environment = Sandbox // Sandbox or Production
// configure
val configuration = BandyerSDKConfiguration.Builder(appId, environment, region).build()

// connect
BandyerSDK.getInstance().connect(Session(userId, object : AccessTokenProvider {
  override fun provideAccessToken(userId: String, completion: Completion<String>) {
    // rest call to your server to request an accessToken for the userId 

// call
val usersToCall = arrayListOf("user to call")
val callIntentBuilder = BandyerIntent.Builder()
String userId = "user id";
String appId = "app id associated to your account starts with mAppID";
String region = "Eu"; // region to which your account belongs: eu, in or us
String environment = "Sandbox"; // Sandbox or Production

// configure
BandyerSDKConfiguration configuration = new BandyerSDKConfiguration.Builder(appId, environment, region).build();

// connect
BandyerSDK.getInstance().connect(new Session(userId, new AccessTokenProvider() {
    public void provideAccessToken(String userId, Completion<String> completion) {
        // rest call to your server to request an accessToken for the userId

// call
ArrayList<String> usersToCall = new ArrayList<>(Arrays.asList("user to call"));
BandyerIntent.Builder callIntentBuilder = new BandyerIntent.Builder()



In sandbox environment โ€˜regionโ€™ is always โ€˜euโ€™.


Good Job!

There are a more customizations available. Refer to Video-Android-SDK for further information.