Live Broadcast Quickstart - Android

Step 1: Obtain the SDK

Download the latest SDK from downloads or contact sales-us@agora.io.

Agora Native SDK for Android has two packages:

Package Structure
Voice Package

The package structure is listed as follows:

./libs: including the required libraries

./samples: including the sample codes

  • Communication: Agora-Android-Voice-Tutorial-1to1
  • Live Broadcast: Not Available
Full Package(including both Voice and Video)

The package structure is listed as follows:

./libs: including the required libraries

./samples: including the sample codes

  • Communication: Agora-Android-Tutorial-1to1
  • Live Broadcast: Open Live

Step 2: Prepare the Environments

  1. Be sure that the following development environment requirements are satisfied:

    • Android SDK API Level> = 16
    • Android Studio 2.0 or later
    • Android real devices with audio and video functionality
    • Apps require Android 4.1 and above devices
    • Prepare an App ID. Refer to Obtaining an App ID
  2. Be sure that the following libraries are ready:

    1. If you use the sample code downloaded in Step 1: Obtain the SDK , then no extra operation is required for this step.
    2. If you use the sample code downloaded from https://github.com/AgoraIO/OpenLive-Android , follow the README.md file within the package.

Step 3: Demonstrate the Live Broadcast

Agora provides a sample code called Open Live. Follow this section to compile and run it.

Compile the Sample Code

Agora provides a sample code called Open Live. Compile the sample code according to the following.

  1. Select Import project (Eclipse ADT, Gradle, etc.) in the Android Studio.

  2. Import OpenLive_Android/build.gradle using the import function of Android Studio.

    ../../_images/android_live_import.png
  3. Fill your own App ID in OpenLive_Android/app/src/main/res/values/strings_config.xml.

For example,

../../_images/android_live_app_id.png
  1. Click the Run button to compile the sample code with real Android devices connected.

Execute the Sample Code

Run the sample code after the compilation. The demonstration requires at least two Android devices:

  1. Open the Open Live application on the Android device, and it displays the following screen:

    ../../_images/android-demo-live-1.png
  2. Enter a channel name in the field of Input Name of Live.

  3. Click the Settings icon on the right top to select the resolution.

    ../../_images/android-demo-live-2.png
  4. Set the user mode.

    1. Join the channel as a host by clicking JOIN ROOM and selecting BROADCASTER.

      After joining the channel, the host mode includes the following functions.

      • Enable/Disable the camera;
      • Mute/Unmute;
      • End the live broadcast;
      ../../_images/android-demo-live-3.png
  1. Join the channel as an audience by clicking JOIN ROOM and selecting AUDIENCE.