Agora provides ensured quality of experience (QoE) for worldwide Internet-based voice and video communications through a virtual global network optimized for real-time web and mobile-to-mobile applications.

As of v2.3.3, Agora Java API Reference for Android can be downloaded from Dash. See FAQ for details.

Channnel management

Method Description
create Creates an RtcEngine instance.
destroy Destroys the RtcEngine instance.
setChannelProfile Sets the channel profile.
setClientRole Sets the user role (Live Broadcast only).
joinChannel Allows a user to join a channel.
switchChannel Switches to a different channel (Live Broadcast only).
leaveChannel Allows a user to leave a channel.
renewToken Renews the token.
enableWebSdkInteroperability Enables interoperability with the Agora Web SDK (Live Broadcast only).
getConnectionState Gets the connection state of the app.

Channel events

Event Description
onConnectionStateChanged Occurs when the network connection state changes.
onJoinChannelSuccess Occurs when a user joins a channel.
onRejoinChannelSuccess Occurs when a user rejoins a channel.
onLeaveChannel Occurs when a user leaves a channel.
onClientRoleChanged Occurs when the user role in a Live Broadcast changes.
onUserJoined Occurs when a remote user joins a channel.
onUserOffline Occurs when a remote user leaves a channel or goes offline.
onNetworkTypeChanged Occurs when the network type changes.
onConnectionLost Occurs when the SDK loses connection to the server.
onTokenPrivilegeWillExpire Occurs when the token expires in 30 seconds.
onRequestToken Occurs when the token expires.

User Info management

Method Description
registerLocalUserAccount Registers a user account.
joinChannelWithUserAccount Joins the channel with a user account.
getUserInfoByUserAccount Gets the user information by passing in the user account.
getUserInfoByUid Gets the user information by passing in the user ID.
Event Description
onLocalUserRegistered Occurs when the local user successfully registers a user account.
onUserInfoUpdated Occurs when the SDK gets the user ID and user account of the remote user.

Audio management

Method Description
enableAudio Enables the audio module.
disableAudio Disables the audio module.
setAudioProfile Sets the audio parameters and application scenarios.
adjustRecordingSignalVolume Adjusts the recording volume.
adjustPlaybackSignalVolume Adjusts the playback volume of the voice.
enableLocalAudio Enables/disables the local audio capture.
muteLocalAudioStream Stops/Resumes sending the local audio stream.
muteRemoteAudioStream Stops/Resumes receving a specified remote audio stream.
muteAllRemoteAudioStreams Stops/Resumes receiving all remote audio streams.
setDefaultMuteAllRemoteAudioStreams Sets whether to receive all remote audio streams by default.

Video management

Method Description
enableVideo Enables the video module.
disableVideo Disables the video module.
setVideoEncoderConfiguration Sets the video encoder configuration.
setupLocalVideo Sets the local video view.
setupRemoteVideo Sets the remote user's video view.
setLocalRenderMode Sets the local video display mode.
setRemoteRenderMode Sets the remote video display mode.
CreateRendererView Creates the video renderer view.
startPreview Starts the local video preview.
stopPreview Stops the local video preview.
enableLocalVideo Enables/Disables the local video capture.
muteLocalVideoStream Stops/Resumes sending the local video stream.
muteRemoteVideoStream Stops/Resumes receiving a specified remote video stream.
muteAllRemoteVideoStreams Stops/Resumes receiving all remote video streams.
setDefaultMuteAllRemoteVideoStreams Sets whether to receive all remote video streams by default.

Local media events

Event Description
onLocalAudioStateChanged Occurs when the local audio state changes.
onLocalVideoStateChanged Occurs when the local video state changes.
onFirstLocalAudioFrame Occurs when the first local audio frame is sent.
onFirstLocalVideoFrame Occurs when the first local video frame is sent.

Remote media events

Event Description
onRemoteAudioStateChanged Occurs when the remote audio state changes.
onRemoteVideoStateChanged Occurs when the remote video state changes.
onUserMuteAudio Occurs when a remote user stops/resumes sending the audio stream.
onUserMuteVideo Occurs when a remote user stops/resumes sending the video stream.
onFirstRemoteAudioFrame Occurs when the first remote audio frame is received.
onFirstRemoteAudioDecoded Occurs when the first remote audio frame is decoded.
onFirstRemoteVideoFrame Occurs when the first remote video frame is rendered.

Statistics events

  • After joining a channel, SDK triggers this group of callbacks once every two seconds.
  • We provide an advanced guide for these callbacks. For details, see In-call Stats.
Event Description
onRtcStats Reports the statistics of RtcEngine.
onNetworkQuality Reports the network quality of each user.
onLocalAudioStats Reports the statistics of the local audio stream.
onLocalVideoStats Reports the statistics of the uploading local video stream.
onRemoteAudioStats Reports the statistics of the audio stream from each remote user/host.
onRemoteVideoStats Reports the statistics of the video stream from each remote user/host.

Video pre-process and post-process

Method Description
setBeautyEffectOptions Sets the image enhancement options.

Screen capture

  • N/A

Audio file playback and mixing

Method Description
startAudioMixing Starts playing and mixing the music file.
stopAudioMixing Stops playing or mixing the music file.
pauseAudioMixing Pauses playing and mixing the music file.
resumeAudioMixing Resumes playing and mixing the music file.
adjustAudioMixingVolume Adjusts the volume of audio mixing.
adjustAudioMixingPlayoutVolume Adjusts the volume of audio mixing for local playback.
adjustAudioMixingPublishVolume Adjusts the volume of audio mixing for remote playback.
getAudioMixingPlayoutVolume Gets the volume of audio mixing for local playback.
getAudioMixingPublishVolume Gets the volume of audio mixing for remote playback.
getAudioMixingDuration Gets the duration (ms) of the music file.
getAudioMixingCurrentPosition Gets the playback position (ms) of the music file.
setAudioMixingPosition Sets the playback starting position (ms) of the music file.
Event Description
onAudioMixingStateChanged Occurs when the state of the local user's audio mixing file changes.

Audio effect playback

Method Description
getAudioEffectManager Gets the IAudioEffectManager class to manage the audio effect files.
getEffectsVolume Gets the volume of the audio effects.
setEffectsVolume Sets the volume of the audio effects.
setVolumeOfEffect Sets the volume of a specified audio effect.
playEffect Plays a specified audio effect.
stopEffect Stops playing a specified audio effect.
stopAllEffects Stops playing all audio effects.
preloadEffect Preloads a specified audio effect file into the memory.
unloadEffect Releases a specified preloaded audio effect from the memory.
pauseEffect Pauses a specified audio effect.
pauseAllEffects Pauses all audio effects.
resumeEffect Resumes playing a specified audio effect.
resumeAllEffects Resumes playing all audio effects.
Event Description
onAudioEffectFinished Occurs when the audio effect file playback finishes.

Voice changer and reverberation

Method Description
setLocalVoiceChanger Sets the local voice changer option.
setLocalVoiceReverbPreset Sets the preset local voice revereration effect.
setLocalVoicePitch Sets the voice pitch of the local speaker.
setLocalVoiceEqualization Sets the local voice equalization effect.
setLocalVoiceReverb Sets the local voice reverberation.

Sound position indication

Method Description
enableSoundPositionIndication Enables/Disables stereo panning for remote users.
setRemoteVoicePosition Sets the sound position and gain of a remote user.

CDN publisher

This group of methods apply to Live Broadcast only.

Method Description
setLiveTranscoding Sets the video layout and audio settings for CDN live.
addPublishStreamUrl Publishes the local stream to the CDN.
removePublishStreamUrl Removes an RTMP stream from the CDN.
Event Description
onRtmpStreamingStateChanged Occurs when the state of the RTMP streaming changes.
onTranscodingUpdated Occurs when the publisher's transcoding settings are updated.

Channel Media Relay

Method Description
startChannelMediaRelay Starts to relay media streams across channels.
updateChannelMediaRelay Updates the channels for media stream relay.
stopChannelMediaRelay Stops the media stream relay.
Event Description
onChannelMediaRelayStateChanged Occurs when the state of the media stream relay changes.
onChannelMediaRelayEvent Reports events during the media stream relay.

Audio volume indication

Method Description
enableAudioVolumeIndication Enables the onAudioVolumeIndication callback at a set time interval to report on which users are speaking and the speakers' volume.
Event Description
onAudioVolumeIndication Reports which users are speaking and the speakers' volume, and whether the local user is speaking.
onActiveSpeaker Reports which user is the loudest speaker.

Audio routing control

Method Description
setDefaultAudioRoutetoSpeakerphone Sets the default audio playback route.
setEnableSpeakerphone Enables/Disables the audio playback route to the speakerphone.
isSpeakerphoneEnabled Checks whether the speakerphone is enabled.
Event Description
onAudioRouteChanged Occurs when the local audio playback route changes.

In-ear monitoring

Method Description
enableInEarMonitoring Enables in-ear monitoring.
setInEarMonitoringVolume Sets the volume of the in-ear monitor.

Dual video stream mode

Method Description
enableDualStreamMode Enables/disables dual video stream mode.
setRemoteVideoStreamType Sets the video stream type of the remotely subscribed video stream.
setRemoteDefaultVideoStreamType Sets the default video stream type of the remotely subscribed video stream.

Stream fallback

Method Description
setLocalPublishFallbackOption Sets the fallback option for the locally published video stream under unreliable network conditions.
setRemoteSubscribeFallbackOption Sets the fallback option for the remotely subscribed video stream under unreliable network conditions.
setRemoteUserPriority Sets the priority of a remote user's stream.
Event Description
onLocalPublishFallbackToAudioOnly Occurs when the locally published video stream falls back to audio only due to poor network conditions or switches back to the video stream after the network conditions improve.
onRemoteSubscribeFallbackToAudioOnly Occurs when the remotely subscribed video stream falls back to audio only due to poor network conditions or switches back to the video stream after the network conditions improve.

Pre-call network test

We provide an advanced guide on the applicable scenarios, implementation and considerations for this group of methods. For details, see Conduct a Last-mile Test.

Method Description
startEchoTest Starts an audio call test.
stopEchoTest Stops the audio call test.
enableLastmileTest Enables the network connection quality test.
disableLastmileTest Disables the network connection quality test.
startLastmileProbeTest Starts the last-mile probe test.
stopLastmileProbeTest Stops the last-mile probe test.
Event Description
onLastmileQuality Reports the last-mile network quality of the local user before the user joins a channel.
onLastmileProbeResult Reports the last-mile network probe result.

Custom video module

Method Description
setVideoSource Customizes the video source.
setLocalVideoRenderer Customizes the local video renderer.
setRemoteVideoRenderer Customizes the remote video renderer.

External video data (push-mode only)

Method Description
setExternalVideoSource Configures the external video source.
pushExternalVideoFrame Pushes the external video frame.
isTextureEncodeSupported Checks if textured video frame is supported.

External audio data (push-mode only)

Method Description
setExternalAudioSource Configures the external audio source.
pushExternalAudioFrame Pushes the external audio frame.

External audio sink

Method Description
setExternalAudioSink Sets the external audio sink.
pullPlaybackAudioFrame Pulls the remote audio frame.

Raw audio data

You can also use the C++ methods for raw audio data.

Method Description
registerAudioFrameObserver Registers an audio frame observer object.
setRecordingAudioFrameParameters Sets the audio recording format for the onRecordFrame callback.
setPlaybackAudioFrameParameters Sets the audio playback format for the onPlaybackFrame callback.
setMixedAudioFrameParameters Sets the mixed audio format.
Event Description
onRecordFrame Occurs when the recorded audio frame is received.
onPlaybackFrame Occurs when the playback audio frame is received.

Raw video data

You can use the C++ methods for raw video data.

  • N/A

Media metadata

Method Description
registerMediaMetadataObserver Registers a media metadata observer object.
Event Description
getMaxMetadataSize Occurs when the SDK requests the maximum size of the metadata.
onReadyToSendMetadata Occurs when the SDK is ready to receive and send metadata.
onMetadataReceived Occurs when the local user receives the metadata.

Watermark

This group of methods apply to Live Broadcast only.

Method Description
addVideoWatermark Adds a watermark image to the local video.
clearVideoWatermarks Removes the added watermark image from the video stream.

Encryption

Method Description
setEncryptionSecret Enables built-in encryption with an encryption password before joining a channel.
setEncryptionMode Sets the built-in encryption mode.

Audio recorder

Method Description
startAudioRecording Starts an audio recording on the client.
stopAudioRecording Stops the audio recording on the client.

Inject an online media stream

  • This group of methods apply to Live Broadcast only.
  • We provide an advanced guide on the applicable scenarios, implementation and considerations for this group of methods. For details, see Inject an Online Media Stream.
Method Description
addInjectStreamUrl Injects an online media stream to a live broadcast.
removeInjectStreamUrl Removes the injected online media stream from a live broadcast.
Event Description
onStreamInjectedStatus Reports the status of injecting the online media stream.

Camera control

Method Description
switchCamera Switches between front and rear cameras.
isCameraZoomSupported Checks whether the camera zoom function is supported.
isCameraTorchSupported Checks whether the camera flash function is supported.
isCameraFocusSupported Checks whether the camera manual focus function is supported.
isCameraExposurePositionSupported Checks whether the camera exposure function is supported.
isCameraAutoFocusFaceModeSupported Checks whether the camera face auto-focus function is supported.
setCameraZoomFactor Sets the camera zoom ratio.
getCameraMaxZoomFactor Gets the maximum zoom ratio of the camera.
setCameraFocusPositionInPreview Sets the camera manual focus position.
setCameraExposurePosition Sets the camera exposure position.
setCameraTorchOn Enables the camera flash function.
setCameraAutoFocusFaceModeEnabled Enables the camera auto-face focus function.
Event Description
onCameraFocusAreaChanged Occurs when the camera focus area changes.
onCameraExposureAreaChanged Occurs when the camera exposure area changes.

Device management

  • N/A

Stream message

Method Description
createDataStream Creates a data stream.
sendStreamMessage Sends data stream messages.
Event Description
onStreamMessage Occurs when the local user receives a remote data stream within five seconds.
onStreamMessageError Occurs when the local user fails to receive the remote data stream.

Miscellaneous video control

Method Description
setLocalVideoMirrorMode Sets the local video mirror mode.
setCameraCapturerConfiguration Sets the camera capturer configuration.

Miscellaneous audio control

  • N/A

Miscellaneous methods

Method Description
getCallId Gets the current call ID.
rate Allows a user to rate a call after the call ends.
complain Allows a user to complain about the call quality after a call ends.
getSdkVersion Gets the SDK version number.
getErrorDescription Gets the warning or error description.
setLogFile Specifies an SDK output log file.
setLogFilter Sets the output log level of the SDK.
setLogFileSize Sets the log file size.
getNativeHandle Gets the native handle of the SDK engine.
addHandler Adds the IRtcEngineEventHandler class.
removeHandler Removes the specified IRtcEngineEventHandler object.

Miscellaneous events

Event Description
onWarning Occurs when a warning occurs.
onError Occurs when an error occurs.
onApiCallExecuted Occurs when an API method is executed.

Customized methods

Method Description
setParameters Provides technical preview functionalities or special customizations by configuring the SDK with JSON options.
getParameter Gets the Agora SDK’s parameters for customization purposes.