The EnableX Android SDK is used to integrate EnableX RTC sessions with your Native Android Applications. The SDK consists of APIs required to communicate with EnableX Signaling Server and Media Server and to listen to event-based notifications during a session.

Released: Oct 1, 2021

Table of Contents

How to use Android SDK?

By using Android Archive Library (.aar)

  • You get the .aar file after downloading the Android SDK.
  • Add the downloaded .aar file under lib folder.
  • Go to your Project’s root directory and edit build.gradle by placing the following code in the allprojects.repositories section:
allprojects {
      repositories {
          flatDir {
              dirs 'src/main/libs'
          }
      }
  }
  • Go to your application’s build.gradle file and add the following code in the dependencies section:
 implementation 'org.webrtc:google-webrtc:1.0.25331'

 implementation('io.socket:socket.io-client:1.0.0') {
     //Excluding org.json which is provided by Android
     exclude group: 'org.json', module: 'json'
 }

 // Add name of the downloaded aar file such as "EnxRtcAndroid-release_1.9.8"
 implementation (name: 'name of the EnableX Android library', ext: 'aar') 
 implementation 'android.arch.lifecycle:extensions:1.1.1'

Note: If your Application uses Android SDK 1.7.0+ then it is mandatory to add
 implementation 'android.arch.lifecycle:extensions:1.1.1' as shown above.

By using Maven Dependency

You can also integrate EnableX Android SDK in your application using Maven. Modify your app gradle to download the Enablex Android SDK.

  • Edit the build.gradle for your project and add the following code in the allprojects.repositories section:
 allprojects {
      repositories {
           maven  {
               url  "https://dl.bintray.com/enablex/maven" 
          }
      }
  } 
  • Modify build.gradle for your module and add the following code snippet in the dependencies section:
implementation 'com.enxrtc:Enx-Rtc-Android:1.7.0'
implementation 'android.arch.lifecycle:extensions:1.1.1'

Define Device Permissions

Define Permissions in AndroidManifest.xml as shown:

<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 features in AndroidManifest.xml as shown:

<uses-feature android:name="android.hardware.camera"/> 
<uses-feature android:name="android.hardware.camera.autofocus"/>  
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>     

Error & Exceptions Handling

When EnableX Android SDK API call fails, it returns a JSON object through Callback as shown:

{
	"errorCode": Number,
	"msg": "String",
	"desc": "String"
}
  • errorCode – Number. Error Code.
  • msg – String. Error Message.
  • desc – String. Optional. A descriptive explanation of the error.

Explore Android SDK