RtcEngineConfig

Configurations for the RtcEngineConfig instance.

public class RtcEngineConfig {
  public Context mContext;
  public String mAppId;
  public Constants.AreaCode mAreaCode;
  public IAgoraEventHandler mEventHandler;
  public int mChannelProfile;
  public int mAudioScenario;
  public boolean mAutoRegisterAgoraExtensions;
  public List<String> mExtensionList;
  public IMediaExtensionObserver mExtensionObserver;
  public LogConfig mLogConfig;
  public String mNativeLibPath;
  public boolean mDomainLimit;

  public static class LogConfig {
    public String filePath;
    public int fileSizeInKB;
    public int level = Constants.LogLevel.getValue(Constants.LogLevel.LOG_LEVEL_INFO);

    @CalledByNative("LogConfig")
    public String getFilePath() {
      return filePath;
    }

    @CalledByNative("LogConfig")
    public int getFileSize() {
      return fileSizeInKB;
    }

    @CalledByNative("LogConfig")
    public int getLevel() {
      return level;
    }
  }

  public RtcEngineConfig() {
    mContext = null;
    mAppId = "";
    mChannelProfile = Constants.CHANNEL_PROFILE_LIVE_BROADCASTING;
    mEventHandler = null;
    mAreaCode = Constants.AreaCode.AREA_CODE_GLOB;
    mExtensionList = new ArrayList<>();
    mExtensionObserver = null;
    mLogConfig = new LogConfig();
    mDomainLimit = false;
    mAutoRegisterAgoraExtensions = true;
  }

  public void addExtension(String providerName) {
    mExtensionList.add(providerName);
  }

  @CalledByNative
  public Context getContext() {
    return mContext;
  }

  @CalledByNative
  public String getAppId() {
    return mAppId;
  }

  @CalledByNative
  public int getChannelProfile() {
    return mChannelProfile;
  }

  @CalledByNative
  public int getAudioScenario() {
    return mAudioScenario;
  }

  @CalledByNative
  public int getAreaCode() {
    return Constants.AreaCode.getValue(mAreaCode);
  }

  @CalledByNative
  public IMediaExtensionObserver getExtensionObserver() {
    return mExtensionObserver;
  }

  @CalledByNative
  public LogConfig getLogConfig() {
    return mLogConfig;
  }
}

Attributes

mEventHandler
The event handler for RtcEngine. See IRtcEngineEventHandler.
mAppId
The App ID issued by Agora for your project. Only users in apps with the same App ID can join the same channel and communicate with each other. An App ID can only be used to create one RtcEngine instance. To change your App ID, call destroy to destroy the current RtcEngine instance, and then create a new one.
mContext

The context of Android Activity.

mNativeLibPath

Specifies the storage directory for the .so files. The storage directory must be a valid and private directory of the app, which can be obtained using Context.getDir().

  • If you set this parameter, the SDK automatically loads the .so files in the directory you specify, so that the app dynamically loads the required .so files when it runs, thereby reducing the package size.
  • If you do not set this parameter or set it to null, the SDK loads the .so files from the default app's native unreal bpLibraryPath when compiling the app, which increases the package size compared to the previous method.
Attention:
  • This method is applicable when you integrate the SDK manually but not when you integrate the SDK with Maven Central or JitPack.
  • Ensure the specified directory exists; otherwise, the RtcEngine initialization fails.
mChannelProfile
The channel profile.
  • CHANNEL_PROFILE_COMMUNICATION(0): Communication. Use this profile when there are only two users in the channel.
  • CHANNEL_PROFILE_LIVE_BROADCASTING(1): Live streaming. Use this profile when there are more than two users in the channel.
  • CHANNEL_PROFILE_GAME(2): This profile is deprecated.
  • CHANNEL_PROFILE_CLOUD_GAMING(3): Interaction. The scenario is optimized for latency. Use this profile if the use case requires frequent interactions between users.
mAudioScenario
The audio scenarios. Under different audio scenarios, the device uses different volume types.
  • AUDIO_SCENARIO_DEFAULT(0): Automatic scenario match, where the SDK chooses the appropriate audio quality according to the user role and audio route.
  • AUDIO_SCENARIO_GAME_STREAMING(3): High-quality audio scenario, where users mainly play music.
  • AUDIO_SCENARIO_CHATROOM(5): Chatroom scenario, where users need to frequently switch the user role or mute and unmute the microphone. In this scenario, audience members receive a pop-up window to request permission of using microphones.
  • AUDIO_SCENARIO_CHORUS(7): Real-time chorus scenario, where users have good network conditions and require ultra-low latency.
    Attention: Before using this enumeration, you need to call getAudioDeviceInfo to see whether the audio device supports ultra-low-latency capture and playback. To experience ultra-low latency, you need to ensure that your audio device supports ultra-low latency (isLowLatencyAudioSupported = true).
  • AUDIO_SCENARIO_MEETING(8): Meeting scenario that mainly involves the human voice.
mAreaCode
The region for connection. This is an advanced feature and applies to scenarios that have regional restrictions. For details on supported regions, see AreaCode. The area codes support bitwise operation.
After specifying the region, the app integrated with the Agora SDK connects to the Agora servers within that region.
mLogConfig

Sets the log file size. See LogConfig.

By default, the SDK generates five SDK log files and five API call log files with the following rules:

  • The SDK log files are: agorasdk.log, agorasdk.1.log, agorasdk.2.log, agorasdk.3.log, and agorasdk.4.log.
  • The API call log files are: agoraapi.log, agoraapi.1.log, agoraapi.2.log, agoraapi.3.log, and agoraapi.4.log.
  • The default size for each SDK log file is 1,024 KB; the default size for each API call log file is 2,048 KB. These log files are encoded in UTF-8.
  • The SDK writes the latest logs in agorasdk.log or agoraapi.log.
  • When agorasdk.log is full, the SDK processes the log files in the following order:
    1. Delete the agorasdk.4.log file (if any).
    2. Rename agorasdk.3.log to agorasdk.4.log.
    3. Rename agorasdk.2.log to agorasdk.3.log.
    4. Rename agorasdk.1.log to agorasdk.2.log.
    5. Create a new agorasdk.log file.
  • The overwrite rules for the agoraapi.log file are the same as for agorasdk.log.
mExtensionList
Extension libraries.
mExtensionObserver
The IMediaExtensionObserver instance.
mDomainLimit
Whether to enable domain name restriction:
  • true: Enables the domain name restriction. This value is suitable for scenarios where IoT devices use IoT cards for network access. The SDK will only connect to servers in the domain name or IP whitelist that has been reported to the operator.
  • false: (Default) Disables the domain name restriction. This value is suitable for most common scenarios.
mAutoRegisterAgoraExtensions
Whether to automatically register the Agora extensions when initializing RtcEngine:
  • true: (Default) Automatically register the Agora extensions when initializing RtcEngine.
  • false: Do not register the Agora extensions when initializing RtcEngine. You need to call enableExtension to register the Agora extensions.

Method

addExtension
Adds the extension. See addExtension.