Agora provides an open-source API-Examples sample project on GitHub. This page describes how to run this project and experience interactive live audio or video streaming.
To create an Agora project, do the following:
Agora automatically assigns each project an App ID as a unique identifier.
To copy this App ID, find your project on the Project Management page in Agora Console, and click the icon in the App ID column.
To ensure communication security, Agora recommends using tokens to authenticate users joining a channel.
For testing purposes, Agora Console supports generating RTC temporary tokens. To generate an RTC temporary token:
Download the API-Examples repository, and find the API-Examples-master/Android/APIExample
sample project.
Agora recommends that you move the APIExample
folder to the root directory of your working disk; otherwise, the project build can fail because the project path is too long.
Fill in the APIExample/app/src/main/res/values/string_config.xml
file with the App ID and temporary token generated in Agora Console.
// Replace YOUR APP ID with your App ID in the string format.
<string name="agora_app_id" translatable="false">YOUR APP ID</string>
// Replace YOUR ACCESS TOKEN with your temporary token in the string format.
<string name="agora_access_token" translatable="false">YOUR ACCESS TOKEN</string>
Enable Developer options and USB Debugging on your Android device, and then connect it to your computer using a USB cable.
Open the APIExample
sample project with Android Studio. Android Studio automatically starts the sync with Grade files.
After the sync is successful, click Run 'app'
on your Android Studio to install the Agora API Example app on your device.
Open the app, select Live Interactive Audio Streaming or Live Interactive Video Streaming, read the prompt, and click Next to join the channel.
Ask a friend to join the live streaming with you using the Agora Web demo app. Ensure that your friend enters the same App ID, channel name, and temporary token. You can then hear or see each other.