Before creating an RtcEngine instance, ensure that you prepared the development environment. See Integrate the SDK.

Create a project in Agora Dashboard and get the App ID of the project. You need to pass in the App ID during initialization.

  1. Sign up for a developer account at Agora Dashboard. See Sign in and Sign up.

  2. Click Get Started under Projects.

  3. Input your project name in the pop-up window and click Create. Follow the on-screen instructions to get to know the basic steps to start a video call. Once the project is created, you can find it under Projects.

  4. Click the Edit button behind the new project, or the Project Management button in the left navigation menu to go to the Project Management page.

  5. On the Project Management panel, find the App ID of your project.


The following imports define the interface of the Agora API that provides communication functionality:

  • io.agora.rtc.Constants
  • io.agora.rtc.IRtcEngineEventHandler
  • io.agora.rtc.RtcEngine

Create a singleton instance by invoking the create method during initialization. In the create method:

  • Pass the Agora App ID. Only apps with the same App ID can join the same channel.
  • Specify a reference to the activity’s event handler. The Agora API uses callbacks to inform the app about Agora engine runtime events, such as joining or leaving a channel and adding users.
import io.agora.rtc.Constants;
import io.agora.rtc.IRtcEngineEventHandler;
import io.agora.rtc.RtcEngine;


private void initializeAgoraEngine() {
    try {
        mRtcEngine = RtcEngine.create(getBaseContext(), getString(R.string.agora_app_id), mRtcEventHandler);
    } catch (Exception e) {
        Log.e(LOG_TAG, Log.getStackTraceString(e));

        throw new RuntimeException("NEED TO check rtc sdk init fatal error\n" + Log.getStackTraceString(e));

Ensure that you call the create method to intiialize the AgoraRtcEngine before calling any other API.

Next Steps

You have created the RtcEngine instance and can start a video call with the following steps:

To check the network connection or audio quality before joining a channel, you can refer to the following sections: