It is very simple to develop an interactive live broadcast application: Shengwang Android Demo nanny-level running tutorial

The author of this article is the user "Xiaohua" from the Agora developer community .

foreword

During my participation in the "SoundNet Developer's Guide", I learned to understand and learn to run through the real-time interactive demo of the sound network, but because the demo provided by the course is on the mobile terminal and the PC terminal, I seldom touched it, so I can only spend a little time. Time to learn to run the demo project.

In view of the fact that the university has studied the java language, I chose the real-time interactive Demo of the Android platform to try to run. Demo warehouse address: https://github.com/AgoraIO/API-Examples

download source code

Just download the compressed package directly, and then unzip it to the specified directory.

insert image description here
Then we should pay attention to the content in the Android directory. Usually, there are detailed README.md documents in the uploaded code warehouse for reading, so we need to see if there are steps to build a development environment.

In API-Examples/Android/APIExample/README.md, the preparation of the environment is described:

insert image description here

Environmental preparation

Because Android Studio is free to use, there is no need for activation codes, just go to the official website to download the installation package and install it.

The installation process is relatively simple. It is almost the same if you can understand English and click next.

After the installation is complete, the first time you open it, it will check the Android SDK components we want to install on the computer. It takes a long time here and it will take some time.

After opening Android Studio, click Open to select the Android project, and the file icon will be specially displayed as the project file:

After opening the project, it will build and download Gradle

insert image description here
After the download is complete and BUILD SUCCESSFUL is displayed, the build is complete, and the project directory structure will become as shown in the figure below:

insert image description here
So far the project is successfully opened and the build is successful. The next step is to use the emulator in Android Studio to run our Demo project.

Run the demo on the emulator

In the toolbar, select the AVD you want to use to run the app from the Target Device drop-down menu. At the beginning, there was no emulator, so we needed to install one.

insert image description here
insert image description here
After installation, select an emulator and click the green triangle to run

Run the demo successfully!

insert image description here
But at this time, the examples in it cannot be run, and the data needs to be configured. It is also mentioned in README.md that let us go to the console of the sound network to create a project.

Get appId and run

The premise is that we have an Acoustics developer account and real-name authentication before we can create a project.

To create our real-time interactive project, I chose the video call type.
insert image description here

Then click into the project to copy the appid.

insert image description here
Create a temporary token.

insert image description here
After running the project, enter the appid, token and channelId to make a video call, because my computer does not have a camera, so I connected to the real machine for debugging. The following is a running one that does not need to fill in the token, but needs to configure the xml. insert image description here
The final effect is as follows. (In order not to expose private information, some pictures were dropped in the mosaic later.)

insert image description here

If you have any questions during the development process, you can communicate with official engineers in the Shengwang developer community .

Guess you like

Origin blog.csdn.net/agora_cloud/article/details/128819371