Before joining the channel, ensure that you prepared the development environment. See Integrate the SDK.


You need to set the channel profile before the app joins a channel.

Set the channel profile as Live Broadcast

After initializing RtcEngine, call the setChannelProfile method to set the channel profile. RtcEngine applies optimization according to the channel profile.

In the setChannelProfile method, set the channel profile as Live Broadcast. This profile applies to an interactive broadcast scenario. Each channel includes two roles:

  • The host(broadcaster) sends and receives audio and video streams
  • The audience receives the audio and video streams.
  • Call the setChannelProfile method before joining a channel.
  • One engine uses one profile only. If you want to switch to another profile, destroy the current RtcEngine using the destroy method and create a new RtcEngine before calling the setChannelProfile method to set the new channel profile.

Join a live broadcast channel

Call the joinChannel method to join a channel.

In the joinChannel method:

  • Pass a token that identifies the role and privilege of the user.
    • For the testing environment, we recommend usign a Temp Token generated on Console. See Get a Temp Token.
    • For the production environment, we recommend using a Token generated at your server. For how to generate a token, see Token Security.
  • Pass a channel ID that identifies the channel. Users that input the same channel ID enter into the same channel.
  • Pass a uid that identifies the user. Each user in a channel requires a unique uid. If you want to join the same channel on different devices, ensure that different uids are used for each device.

Once in a channel, a user must call the leaveChannel method to exit the current channel before entering another channel.

 private void joinChannel() {
    mRtcEngine.joinChannel("token", "demoChannel1", "Extra Optional Data", 0); // If you do not specify the uid, Agora will assign one.

Next Steps

You are in the channel and can start a live broadcast with the following steps:

For more functions, you can refer to the following sections: