Android Video SDK

The EnableX Android SDK (EnxRtcAndroid) is a native Android library that integrates real-time audio and video into your Android app. It communicates directly with EnableX signalling and media servers, and delivers session notifications to your application through a structured Observer / Callback pattern — the Android equivalent of web event listeners.

Prerequisites

Before integrating the SDK, ensure the following are ready on your server:

  1. App Credentialsapp_id and app_key from the EnableX Portal. Keep these on your server only — never embed in the APK.
  2. A Room — created via the Video API. Store the room_id.
  3. A Token — generated server-side via Create Token API for each participant before they join.
Installation

The Android SDK is distributed as two .aar archive files — the EnableX SDK itself and a bundled WebRTC library. Both must be included in your project.

⇩  Download Android SDK v3.0.3 ⇩  Download WebRTC Library

Android SDK v3.0.3 — Released September 30, 2025  |  WebRTC Library — Released July 24, 2025

Method 1 — Add .aar files to libs/

Extract both ZIP archives to get the .aar files, then copy them into your app module's libs/ folder and update your app-level build.gradle:

dependencies {
    implementation fileTree(dir: "libs", include: ["*.aar"])
    implementation('io.socket:socket.io-client:2.1.2') {
        exclude group: 'org.json', module: 'json'
    }
    implementation 'android.arch.lifecycle:extensions:1.1.1'
}

Method 2 — Separate module (Recommended)

This approach isolates the SDK files cleanly and works better with multi-module projects.

  1. Create a new directory in your project root, e.g. enx-sdk/. Place both .aar files inside it.
  2. Create a build.gradle in that directory:
configurations.maybeCreate('default')
artifacts.add('default', file('EnxRtcAndroid-release_3.0.3.aar'))
artifacts.add('default', file('libWebRtc.aar'))
  1. Register the module in your root settings.gradle:
include ':enx-sdk'
  1. Add it as a dependency in your app's build.gradle:
implementation project(":enx-sdk", configuration: "default")

AndroidManifest.xml — Permissions & Features

Add the following to your AndroidManifest.xml. Camera and microphone are required for audio/video; the remaining entries support networking, storage, and Bluetooth audio devices.

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

<!-- Hardware features -->
<uses-feature android:name="android.hardware.camera"/>
<uses-feature android:name="android.hardware.camera.autofocus"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>
Working with Observers & Callbacks

Observers — The Android Callback Pattern

In the Android SDK, all asynchronous notifications arrive through Observers. These are Java interfaces your Activity or Fragment implements. When something happens in the session — a stream is published, recording starts, a user joins — the SDK calls the corresponding method on the registered observer.

There are two levels of observers:

Core Observers (registered in the constructor)

The two primary observers are passed when you create the EnxRoom instance. They handle the most common room and stream events:

// Your Activity implements EnxRoomObserver and EnxStreamObserver
public class VideoActivity extends AppCompatActivity
        implements EnxRoomObserver, EnxStreamObserver {

    private EnxRoom room;

    void initRoom() {
        room = new EnxRoom(
            this,   // EnxRoomObserver  — receives room-level callbacks
            this    // EnxStreamObserver — receives stream-level callbacks
        );
        room.init(this); // pass the Activity context
    }

    // Called when your client successfully connects to the room
    @Override
    public void onRoomConnected(EnxRoom room, JSONObject roomMetaData) {
        Log.d("ENX", "Room connected: " + roomMetaData);
    }

    // Called when a new remote stream is available
    @Override
    public void onStreamAdded(EnxStream stream) {
        room.subscribe(stream); // subscribe to receive it
    }
}

Feature Observers (registered via setters)

Specialised features use dedicated observer interfaces that you register via setter methods — always before calling the feature method:

// Recording
room.setRecordingObserver(this);
room.startRecord();

// Hard mute
room.setMuteRoomObserver(this);
room.hardMute();

// Floor access (Lecture Mode)
room.setChairControlObserver(this);
room.requestFloor();

// File sharing
room.setFileShareObserver(this);
room.sendFiles(files, options);

// Active talker list (custom view mode)
room.setActiveTalkerListObserver(this);
// or for predefined RecyclerView mode:
room.setActiveTalkerViewObserver(this);
Always register an observer before calling its feature method. Calling startRecord() without first calling setRecordingObserver() means you will not receive the recording callbacks. The same applies to all feature observers.

Callback Naming Convention

All callbacks follow predictable naming that tells you who receives them:

SDK Classes & Key Attributes
ClassRoleKey Responsibilities
EnxRtc Base Class Quick-join via joinRoom(), pre-call diagnostics, client bitrate test
EnxRoom Room Handler Connect/disconnect, publish/subscribe streams, moderation, recording, floor control, breakout rooms
EnxStream Stream Handler Local stream config, mute/unmute, camera switching, stream attributes, attach to player view
EnxPlayerView Video Renderer Android View component for rendering a stream's video track. Add to any ViewGroup in your layout

Key Room Attributes

AttributeTypeDescription
room.roomIDStringUnique room identifier
room.clientIDStringThis endpoint's client ID assigned by EnableX
room.remoteStreamsList<EnxStream>Remote streams currently in the room
room.localStreamsList<EnxStream>Streams published by this endpoint
room.statusint0=Disconnected, 1=Connecting, 2=Connected
room.awaitedParticipantsListUsers waiting for moderator approval in knock-enabled rooms
room.raisedHandsListUsers requesting floor access in Lecture mode
room.approvedHandsListUsers currently holding floor access
Error Handling

When an SDK method fails, the error is returned as a JSONObject through the callback. Note that Android uses errorCode — not result — as the primary error field:

{
  "errorCode": 5013,
  "msg": "Failed to publish stream",
  "desc": "Optional extended description of the error"
}
FieldTypeDescription
errorCodeNumberNon-zero numeric error code identifying the failure
msgStringShort error message
descStringOptional. Human-readable explanation
Success has no errorCode. Unlike the Web SDK which uses result: 0 for success, the Android SDK signals success by calling the success callback (onRoomConnected, onPublishedStream, etc.). The error callback with an errorCode is only invoked on failure.
Feature Guide

The Android SDK documentation is organized into focused topic pages. Each page covers a feature area with method signatures, observer setup, callback descriptions, and Java code examples.

Connecting to a Session
Step-by-step: get devices → create room → register observers → connect → publish → subscribe → disconnect.
Stream Management
Publish/unpublish, mute/unmute audio & video, switch camera, active talkers, EnxPlayerView, video quality.
In-Session Communication
Chat (send/edit/delete), file sharing, screen share, canvas streaming, annotation, live transcription.
Session Management
Recording, live recording, hard mute, lock/unlock room, moderated entry, drop users, roles, RTMP streaming.
Breakout Rooms
Create breakout rooms, invite participants, join, reject, pause/resume parent room, destroy all.
Floor Access Control
Lecture mode floor requests, grant/deny/release, invite to floor, chair control observer setup.
Developer Tools & Aside Room
Pre-call diagnostics, media stats, logging, audio-only mode, PSTN dial-out, and joining an aside room.