Vonage Video API Android SDK

The Vonage Video API Android SDK lets you use Vonage Video API-powered video sessions in apps you build for Android devices.

Important notes:

  • Android SDK 2.29.1+ requires the ACCESS_NETWORK_STATE permission, and on Android API level 35+ it also requires the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission. Check out the full list of required permissions.
  • Android SDK 2.28.0+ requires a minimum Android API level of 24.
  • Android SDK 2.24.3+, 2.25.4+, and 2.26.0+ requires a minimum Android API level of 23.
  • Android SDK 2.24.0 and above no longer support 32-bit x86 architectures.
  • Applications targeting API level 31 and above now require permission READ_PHONE_STATE. Check out the full list of required permissions.

All applications that use the Vonage Video API are composed of two parts:

  • The client-side, which uses the OpenTok client SDKs and runs in a user's browser or mobile app
  • The server-side, which uses the OpenTok server SDKs and runs on your server to pass authentication information to the client.

The client SDK for building Android apps is the OpenTok Android SDK, which provides most of the core functionality for your app, including:

  • Connecting to an OpenTok session
  • Publishing streams to a session
  • Subscribing to streams in a session

Client SDKs are also available for web, iOS, Windows, macOS, Linux, and React Native. All OpenTok client SDKs can interact with one another.

You can learn more about the basics of OpenTok clients, servers, sessions, and more on the Video API Basics page.

The best way to learn how to use the OpenTok Android SDK is to follow the OpenTok Basic Video Chat tutorial.

Once you understand the basics of building with the OpenTok Android SDK, you can get more detailed information and learn how to customize your application with the OpenTok developer guides. To investigate specific API classes and methods, see the OpenTok Android SDK API reference.

For sample code, visit our vonage-video-android-sdk-samples repo on GitHub.

Apps written with the OpenTok Android SDK 2.34.1 can interoperate with OpenTok apps written with version 2.32+ of the OpenTok client SDKs:

  • OpenTok.js
  • OpenTok Android SDK
  • OpenTok iOS SDK
  • OpenTok Windows SDK
  • OpenTok macOS SDK
  • OpenTok Linux SDK

A Maven version is available at https://search.maven.org/artifact/com.opentok.android/opentok-android-sdk. The artifact ID is "opentok-android-sdk". For more information, see Creating your own app using the OpenTok Android SDK.

The OpenTok Android SDK supports one published audio-video stream, one subscribed audio-video stream, and up to five additional subscribed audio-only streams simultaneously. To connect more than two clients in a session using the OpenTok Android SDK, create a session that uses the OpenTok Media Router (a session with the media mode set to routed). See The OpenTok Media Router and media modes.

The SDK is supported on high-speed Wi-Fi and 4G LTE networks.

The OpenTok Android SDK is supported on armeabi-v7a, armeabi64-v8a, and x86_64 architectures.

The SDK supports both 4 KB and 16 KB page size devices from version 2.30.0 onwards. This ensures functionality, enhances compatibility, and prevents crashes. For more information, see this Android documentation on page sizes.

The OpenTok Android SDK works with any Android 7.0+ device (Nougat, API Level 24) that has a camera (for publishing video) and adequate CPU and memory support.

For reliable video streaming, ensure your Android device meets these recommended specs:

  • CPU: A recent dual-core processor; ARM64 (ARMv8) Quad-core or higher at 2.0 GHz+ (e.g., Qualcomm Snapdragon 600+ series, Samsung Exynos 7 series or higher, Google Tensor (Pixel devices)).
  • GPU: Adreno 500+ series (Qualcomm), Mali-G71+ (ARM); for hardware-accelerated video encoding/decoding.
  • RAM: At least 6 GB RAM for group calls and multitasking.
  • Display: 5"+ for better user experience.
  • Battery capacity: 3000+ mAh for extended video calls.
  • Network: Reliable internet connectivity; works over Wi‑Fi or cellular.

These recommendations ensure stable playback, lower CPU usage, and smooth performance when streaming video.

Device examples by category: Samsung Galaxy A12, Moto G Play, and Nokia G10 are entry-level; Google Pixel 6a, Samsung Galaxy A52/A53, and OnePlus Nord are mid-range; and Samsung Galaxy S23/S24, Google Pixel 8 Pro, and OnePlus 11 are high-end.

A Maven version is available at https://search.maven.org/artifact/com.opentok.android/opentok-android-sdk. The artifact ID is "opentok-android-sdk". Modify your app to download the OpenTok Android SDK from https://search.maven.org/artifact/com.opentok.android/opentok-android-sdk. For example:

  1. Edit the build.gradle for your project and add the following code snippet to the allprojects/repositories section:

    mavenCentral()
    
  2. Modify the app's build.gradle file and add the following code snippet to the dependencies section:

    implementation 'com.opentok.android:opentok-android-sdk:2.34.0'
    
  3. Modify the app's build.gradle file and add the following code snippet to the android section:

    For Android SDK above 2.28.1:

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    

    For Android SDK between 2.22.0 and 2.28.1:

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
    

    For Android SDK below 2.22.0:

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    

Your app needs to use a session ID and token generated with your OpenTok API key, which you can get by logging into your Vonage Video API account.

For test purposes, you can generate a session ID and token by logging into your Vonage Video API account. For a production app, generate unique tokens (and session IDs, if you need to support multiple sessions) using the OpenTok server-side libraries.

The OpenTok Android SDK uses following permissions:

  • android.permission.ACCESS_NETWORK_STATE -- The OpenTok Android SDK requires this permission from version 2.29.1 onwards.

  • android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS -- The OpenTok Android SDK requires this permission from version 2.29.1 onwards in API level 35 and above.

  • android.permission.BLUETOOTH_CONNECT -- You need to enable this for API level 31 and above. If you want to use the Bluetooth device with Android SDK DefaultAudioDevice targeting API level 31 and above, please ask for runtime permissions in the app or enable the ("Nearby devices/Bluetooth") permission manually in the app settings.

  • android.permission.READ_PHONE_STATE -- The OpenTok Android SDK requests this permission in API level 22 and lower, and 31 and above.

  • android.permission.CAMERA -- If your app does not use the default video capturer and does not access the camera, you can remove this permission.

  • android.permission.INTERNET -- Required.

  • android.permission.RECORD_AUDIO -- If your app does not use the default audio device and does not access the microphone, you can remove this permission.

  • android.permission.MODIFY_AUDIO_SETTINGS -- If your app does not use the default audio device and does not access the microphone, you can remove this permission.

  • android.permission.BLUETOOTH -- The default audio device supports Bluetooth audio. If your app does not use the default audio device and does not use Bluetooth, you can remove this permission.

  • android.permission.BROADCAST_STICKY -- We have determined that this is unused by the OpenTok Android SDK, and we will remove this permission from an upcoming release.

You do not need to add these to your app manifest. The OpenTok Android SDK adds them automatically. However, in API level 21 and higher, certain permissions require you to prompt the user.

Your app can remove any of these permissions that will not be required. See this post and this Android documentation. For example, this removes the android.permission.CAMERA permission:

<uses-permission android:name="android.permission.CAMERA" tools:node="remove"/>

ProGuard rules needed by the OpenTok Android SDK

The recommended ProGuard configuration is:

-keeppackagenames
-keep class com.opentok.** { *; }
-keep class com.vonage.** { *; }

When using Android Studio 3.4 or Android Gradle plugin 3.4.0+, shrinking, obfuscation and optimization are, by default, automatically enabled.

Shrinking and obfuscating the OpenTok Android SDK is not recommended.

The configuration above forces the OpenTok Android SDK source code to be kept, not disallowing the rest of the app to be shrunk.

Preserve the OpenTok Android SDK package names with the flag -keeppackagenames to prevent conflicts with other libraries.

The compiler automatically performs a set of optimizations by default. Any other optimizations are not recommended, but it is possible to enable additional optimizations, which may require to include additional ProGuard rules to avoid runtime issues, by adding the following in the project’s gradle.properties file:

android.enableR8.fullMode=true

Minifying the OpenTok Android SDK is not recommended. Shrinking and obfuscating the OpenTok Android SDK with the preceding optimization will generate warnings. These should be disabled.

# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
-dontwarn org.bouncycastle.jsse.BCSSLParameters
-dontwarn org.bouncycastle.jsse.BCSSLSocket
-dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider
-dontwarn org.conscrypt.Conscrypt$Version
-dontwarn org.conscrypt.Conscrypt
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE

See this Android documentation to have a better understanding of the overall ProGuard rules and its functionalities.