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.
Before integrating the SDK, ensure the following are ready on your server:
- App Credentials —
app_idandapp_keyfrom the EnableX Portal. Keep these on your server only — never embed in the APK. - A Room — created via the Video API. Store the
room_id. - A Token — generated server-side via Create Token API for each participant before they join.
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.
- Create a new directory in your project root, e.g.
enx-sdk/. Place both.aarfiles inside it. - Create a
build.gradlein that directory:
configurations.maybeCreate('default')
artifacts.add('default', file('EnxRtcAndroid-release_3.0.3.aar'))
artifacts.add('default', file('libWebRtc.aar'))
- Register the module in your root
settings.gradle:
include ':enx-sdk'
- 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"/>
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);
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:
- Callbacks starting with onACK or onYourAction (e.g.,
onStartRecordingEvent,onPublishedStream) — delivered only to the user who triggered the action. - Callbacks like
onRoomRecordingOn,onUserConnected,onStreamAdded— delivered to all participants in the room.
| Class | Role | Key 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
| Attribute | Type | Description |
|---|---|---|
room.roomID | String | Unique room identifier |
room.clientID | String | This endpoint's client ID assigned by EnableX |
room.remoteStreams | List<EnxStream> | Remote streams currently in the room |
room.localStreams | List<EnxStream> | Streams published by this endpoint |
room.status | int | 0=Disconnected, 1=Connecting, 2=Connected |
room.awaitedParticipants | List | Users waiting for moderator approval in knock-enabled rooms |
room.raisedHands | List | Users requesting floor access in Lecture mode |
room.approvedHands | List | Users currently holding floor access |
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"
}
| Field | Type | Description |
|---|---|---|
errorCode | Number | Non-zero numeric error code identifying the failure |
msg | String | Short error message |
desc | String | Optional. Human-readable explanation |
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.
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.