Before creating an RtcEngine instance, ensure that you have finished preparing the development environment. See Integrate the SDK for more information.


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 by invoking create during initialization. In this method:

  • Pass the Agora App ID. Only Applications with the same App ID can join the same channel.
  • Specify a reference to the activity’s event handler. The Agora API uses events to inform the application about Agora engine runtime events, such as joining or leaving a channel and adding new participants.
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));

Next Steps

You have now finished creating the RtcEngine instance and can start a voice call with the following steps:

For added requirements on network connection or audio quality, you can also take the following steps before joining a channel: