To meet the laws and regulations of different countries or regions, the Agora RTC SDK supports geofencing. After enabling geofencing, the SDK only connects to Agora servers within the specified region, regardless of where your app users are located.
For example, if you specify North America as the region for connection, when two users attempt to connect to Agora servers from different locations, the result is as follows:
Specified region for connection | App user location | Actual region for connection | User experience after connection 1 |
---|---|---|---|
North America | North America | North America | Normal |
China | Can be less than optimal 2 |
You need to call setRtmServiceContext
before calling createRtmService
to initialize the RTM client. The RTM SDK supports the following regions:
AREA_CODE_GLOB
: (Default) Global.AREA_CODE_CN
: Mainland China.AREA_CODE_NA
: North America.AREA_CODE_EU
: Europe.AREA_CODE_AS
: Asia excluding mainland China.AREA_CODE_JP
: Japan.AREA_CODE_IN
: India.// Set region for geofencing
RtmServiceContext ctx = new RtmServiceContext();
ctx.areaCode = RtmServiceContext.RtmAreaCode.AREA_CODE_CN | RtmServiceContext.RtmAreaCode.AREA_CODE_AS;
RtmClient.setRtmServiceContext(ctx);
If a firewall is deployed in your network environment, ensure that you add the domains in the following table according to the region you specify, allow all IP addresses, and open the following firewall ports.
Region | Domain |
---|---|
Mainland China | ap.agoraio.cn report-edge.agoraio.cn service-agoraio.cn |
North America | ap-america.agora.io report-america.agora.io service-america.agora.io |
Europe | ap-europe.agora.io report-europe.agora.io service-europe.agora.io |
Japan | ap-japan.agora.io report-japan.agora.io service-japan.agora.io |
India | ap-india.agora.io report-india.agora.io service-india.agora.io |
Asia excluding mainland China | ap-asia.agora.io report-asia.agora.io service-asia.agora.io |