Agora provides an open-source OpenLive-Voice-Only-Android sample project on GitHub. This document introduces how to run this project and experience a live audio streaming implemented by the Agora SDK.
Create a project in Agora Console, as follows:
Log in to Console, and click in the left navigation menu to enter the Project Management page.
Click Create.
Enter your project name, and select Secure mode: APP ID + Token for the authentication mechanism in the pop-up window.
Click Submit. You can see the created project on the Project Management page.
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 eye icon to the right of the App ID.
To ensure communication security, Agora uses tokens (dynamic keys) to authenticate users joining a channel.
Agora Console supports generating temporary tokens for testing purposes.
On the Project Management page, find your project, and click to open the Token page.
Enter a channel name, and click Generate Temp Token to get a temporary token. When joining the channel, ensure that the channel name is the same with the one that you use to generate the temporary token.
Basic-Audio-Broadcasting/OpenLive-Voice-Only-Android
sample project. Fill in the app/src/main/res/values/strings.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"><#YOUR APP ID#></string>
// Replace #YOUR ACCESS TOKEN# with your temporary token in the string format
<string name="agora_access_token">#YOUR ACCESS TOKEN#</string>
Integrate the Agora Voice SDK into the sample project, as follows:
Download the latest version of the Agora Voice SDK and extract the files from the downloaded package.
Copy the following files or subfolders from the libs
folder of the SDK package to the corresponding folder of the sample project:
File/Folder | Path |
---|---|
agora-rtc-sdk.jar | /app/libs/ |
arm-v8a folder | /app/src/main/jniLibs/ |
armeabi-v7a folder | /app/src/main/jniLibs/ |
x86 folder | /app/src/main/jniLibs/ |
x86_64 folder | /app/src/main/jniLibs/ |
Connect the Android device to your computer, open the OpenLive-Voice-Only-Android sample project on Android Studio, and then build and run the project.
After the IDE successfully installs the app on your Android device, you can see the following user interface:
You have joined the test channel by default. If you want to experience a live audio streaming, you can use the Agora Web demo app to interact with your Android device. Ensure that you enter the same App ID, channel name, and temporary token in the Agora Web demo app.