Communication Integration - Android

Step 1: Obtain the SDK

Download either of the following latest Agora Native SDKs from downloads or contact sales-us@agora.io:

  • Voice Package
  • Full Package

Each package has libs and samples folders, while samples is used in Communication Quickstart - Android.

Step 2: Prepare the Environments

  1. Be sure that the following development environments are satisfied:

    • Android SDK API Level> = 16
    • Android Studio 2.0 or later
    • Real Android devices with audio and video functionality
    • Apps require Android 4.1 and above devices
  2. Copy the following libraries from the libs folder included in the package downloaded in Step 1: Obtain the SDK according to your actual needs.

    • agora-rtc-sdk.jar (mandatory)
    • armeabi-v7a/
    • x86/
    • arm64-v8a
    • include

    Note

    When you copy the libraries to the libs folder in the targeted path, and if there is any Chinese character in the path, the sample code won’t be compiled successfully, and it will display ASCII code in the error message.

  3. Put the above required libraries, for example, jar file and so file in the correct libs path according to the settings in the build.gradle file, for example,

    ../../_images/android_library.png
  4. Specify the directory of the so file in the build.gradle file as the path of the libs folder in the above step.

    For example,

    ../../_images/android_so.png
  5. Import the AAR package.

    Note

    This step is only applicable to the users who want to integrate the image enhancement function in Agora Native SDK.

    1. Download the latest Image Enhancement package from http://www.agora.io/downloads/.

    2. Select File > Project Structure… in the Android Studio.

      ../../_images/android_project_structure.png
    1. Click +.

      ../../_images/android_project_add.png
    2. Click Import .JAR/.AAR Package and proceed with Next.

      ../../_images/android_project_aar.png
    3. Select the required aar file.

      ../../_images/android_select_aar.png
    4. Once imported, a new folder will be created under the root directory, for example,

      ../../_images/android_display_aar.png
  6. Configure the NDK if the following error displays:

    ../../_images/android6.png

    It means the NDK is not installed. Download it from website, and put it in the Android location, for example,

    ../../_images/android7.png
  7. The following permissions are required in the AndroidManifest.xml file for your application when deployed:

    • <uses-permission android:name=”android.permission.INTERNET” />
    • <uses-permission android:name=”android.permission.RECORD_AUDIO” />
    • <uses-permission android:name=”android.permission.CAMERA” />
    • <uses-permission android:name=”android.permission.MODIFY_AUDIO_SETTINGS” />
    • <uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE” />
  8. Click Sync Project With Gradle Files until the sync is complete.

    ../../_images/android9.png

Note

When you write the obfuscated code, be sure that you add the following code.

../../_images/mixed_code.png

Step 3: Call APIs

Refer to Communication API - Android to implement the required functions.