Table of Contents
Note: Installation instruction given below are applicable from Android SDK v2.3.3.
By using Android Archive Library (.aar)
- Get Android SDK: Download Android SDK. Extract it. You get .aar file for Android SDK.
- Get WebRTC SDK: Download WebRTC SDK. Extract it. You get .aar file for WebRTC SDK.
Process# 1
- Add to lib: Add both downloaded .aar files under
lib
folder. - Edit App’s gradle: Go to your application’s
build.gradle
file and add the following code in thedependencies
section:
implementation fileTree(dir: "libs", include: ["*.aar"]) implementation('io.socket:socket.io-client:1.0.0') { // Exclude org.json provided by Android exclude group: 'org.json', module: 'json' } implementation 'android.arch.lifecycle:extensions:1.1.1'
Process# 2
This is alternate to Process#1.
- Go to Project root and create a new directory.
- Put the following content into the
build.gradle
file within the new directory:
configurations.maybeCreate("default") artifacts.add("default", file('[nameOfTheAar].aar'))
- Place both downloaded
.aar
files into this new directoy next to thebuild.gradle
file. - Add the newly created directory to the
settings.gradle
file:
include(":path/new-directory")
- Include the newly created library into 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 .aar files.
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 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.