Android SDK Overview
The EnableX Android SDK integrates EnableX RTC sessions with native Android applications. The SDK consists of APIs for communicating with EnableX Signalling and Media servers and for listening to event-based notifications during a session.
Download Android SDK v2.3.18
Released: July 24, 2024Download WebRTC Library
Released: December 1, 2022Getting Started
Note: This topic provides details about downloading and installing Android SDK v2.3.3. You can use these details for downloading other Android SDK versions unless specified otherwise by EnableX.
By Using Android Archive Library (.aar)
To obtain the Android SDK:
- Download the Android SDK from the EnableX portal.
- Extract the SDK zipped file and locate the .aar file in the extracted contents.
To obtain the WebRTC SDK:
- Download WebRTC SDK from the EnableX portal.
- Extract the SDK zipped file and locate the .aar file in the extracted contents.
Using the SDK: Process 1
-
Add the .aar files from the extracted folders of Android SDK and WebRTC SDK under the lib folder.
-
Go to your application's build.gradle file and add the following code in the dependencies section:
implementation fileTree(dir: "libs", include: ["*.aar"])implementation('io.socket:socket.io-client:1.0.0') {// Exclude org.json provided by Androidexclude group: 'org.json', module: 'json'}implementation 'android.arch.lifecycle:extensions:1.1.1'
Using the SDK: Process 2
Note: Use this procedure as an alternative to Process 1.
-
Go to the root directory of your project and create a new directory.
-
Add the following code in the build.gradle file within the new directory:
configurations.maybeCreate('default')artifacts.add('default', file('[nameOfTheAar].aar')) -
Place both downloaded .aar files from Android SDK and WebRTC SDK in the new directory next to the build.gradle file.
-
Add the name of the newly created directory in the settings.gradle file:
include(':path/new-directory') -
Include the newly created directory in your application.
implementation project(":path/new-directory", configuration = "default")
Note: Process 2 is a better approach than Process 1 as it creates a module to add the .aar files.
Define Device Permissions
Define the camera and microphone permissions needed on the Android device. To define these permissions, modify the AndroidMainfest.xml file as below.
<uses-permission android:name="android.permission.CAMERA"/><uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/><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.WRITE_EXTERNAL_STORAGE"/><uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/><uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/><uses-permission android:name="android.permission.BLUETOOTH"/><uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
Define Features
Define the features in the AndroidManifest.xml file as shown below:
<uses-feature android:name="android.hardware.camera"/><uses-feature android:name="android.hardware.camera.autofocus"/><uses-feature android:glEsVersion="0x00020000" android:required="true"/>
Error and Exceptions Handling
When an SDK method call encounters an issue and fails, a JSON object containing the details of the error is returned through callback. Below is an example of this JSON object:
{"errorCode": Number,"msg": "String","desc": "String"}
The parameters added in this example are described below.
Parameter | Type | Description |
---|---|---|
errorCode | Number | Returns an error code depending on the error encountered. |
msg | String | Returns an error message depending on the error encountered. |
desc | String | Optional. Returns explanation of the error encountered. |
SDK Methods
The SDK provides several methods for implementing different features and functionalities. For more information, see List of SDK Methods.
Media Devices
The SDK provides several methods to access device cameras and microphones that can be used to create media streams to publish into the video rooms. For more information, see Get Media Devices.
Stream Configuration
The SDK supports local and remote streams. For more information, see:
Room Configuration
The SDK supports the following room configurations:
In-session Communication
The SDK provides several methods for managing in-session communication including chat, custom signalling, file sharing, screen sharing, canvas streaming, annotations, and live transcription. For more information, see In-Session Communication.
Session Management
The SDK provides several methods for managing different aspects of video sessions including recording a session, watermarking a recorded file, live recording with UI, muting or unmuting a room or a participant, forcing room entry restrictions, RTMP live streaming, HLS streaming, disconnecting a user from a session, extending or concluding a session, switching participant roles, pinning or unpinning a user, spotlighting a user, and switching the room mode. For more information, see Session Management.
Breakout Room
The SDK provides several methods for implementing breakout rooms. For more information, see Breakout Rooms.
Aside Room
The SDK provides a method to allow a moderator or a participant of an ongoing session of a room to join another room as a participant with audio or video and communicate with everyone in that room. For more information, see Join Aside Room.
Floor Access Control in Lecture Mode
Participants can request for floor access in the Lecture mode. The SDK provides different methods to implement floor access. For more information, see Floor Access Control in Lecture Mode.
Live Statistics
The SDK provides several methods to obtain live statistics of local, remote, canvas streaming, and screen sharing during a session. For more information, see Live Statistics.
Utilities
The SDK provides several methods for managing different aspects of video sessions through different utilities. For more information, see Utilities.