# Restrict media zones (/en/realtime-media/rtm/build/secure-your-app-and-data/geofencing)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

<_PlatformTabsGroup groupMode="structured" canonicalPlatform="web" platforms="[&#x22;web&#x22;,&#x22;android&#x22;,&#x22;ios&#x22;,&#x22;macos&#x22;,&#x22;flutter&#x22;,&#x22;react-native&#x22;,&#x22;windows&#x22;,&#x22;linux-cpp&#x22;,&#x22;unity&#x22;]" showTabs="true">
  <_PlatformPanel platform="web">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="web" />

    To comply with local laws and regulations, you can restrict user connections to specific geographic zones. Agora enables you to control data routing in your app by specifying the Agora SDRTN® zones that users can connect to.

    ## Understand the tech [#understand-the-tech]

    When you set area codes in your client configuration, the SDK only accesses the Agora server in the specified zone(s), irrespective of the geographical location of the user.

    The following zones are available:

    * **GLOB**: Global (Default)
    * **NA**: North America
    * **CN**: Mainland China.
    * **AS**: Asia excluding mainland China.
    * **EU**: Europe
    * **IN**: India
    * **JP**: Japan

    ## Prerequisites [#prerequisites]

    Ensure that you have implemented the [SDK quickstart](/en/realtime-media/rtm/quickstart) in your project.

    ## Configure geographical zones [#configure-geographical-zones]

    To configure geographical access, specify area codes in the configuration when you initialize a Signaling client instance. You can combine the codes to include or exclude specific zones.

    ```js
    // Set whitelist and blacklist areas
    AgoraRTM.setArea({ areaCodes: ["GLOBAL"], excludedArea: "CHINA" })
    ```

    ## Reference [#reference]

    This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

    ### API reference [#api-reference]

    * [Initialization](/en/api-reference/api-ref/signaling#initialization)
    * [`RtmConfig`](/en/api-reference/api-ref/signaling#configrtmpropsag_platform)

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="android">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="android" />

    To comply with local laws and regulations, you can restrict user connections to specific geographic zones. Agora enables you to control data routing in your app by specifying the Agora SDRTN® zones that users can connect to.

    ## Understand the tech [#understand-the-tech-1]

    When you set area codes in your client configuration, the SDK only accesses the Agora server in the specified zone(s), irrespective of the geographical location of the user.

    The following zones are available:

    * **GLOB**: Global (Default)
    * **NA**: North America
    * **CN**: Mainland China.
    * **AS**: Asia excluding mainland China.
    * **EU**: Europe
    * **IN**: India
    * **JP**: Japan

    ## Prerequisites [#prerequisites-1]

    Ensure that you have implemented the [SDK quickstart](/en/realtime-media/rtm/quickstart) in your project.

    ## Configure geographical zones [#configure-geographical-zones-1]

    To configure geographical access, specify area codes in the configuration when you initialize a Signaling client instance. You can combine the codes to include or exclude specific zones.

    <CodeBlockTabs defaultValue="Java">
      <CodeBlockTabsList>
        <CodeBlockTabsTrigger value="Java">
          Java
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="Kotlin">
          Kotlin
        </CodeBlockTabsTrigger>
      </CodeBlockTabsList>

      <CodeBlockTab value="Java">
        ```java
        RtmConfig rtmConfig = new RtmConfig.Builder("<your_app_id>", "<your_user_Id>")
            .areaCode(EnumSet.of(RtmConstants.RtmAreaCode.AS, RtmConstants.RtmAreaCode.CN))
            .eventListener(eventListener)
            .build();
        ```
      </CodeBlockTab>

      <CodeBlockTab value="Kotlin">
        ```kotlin
        val rtmConfig = RtmConfig.Builder("appid", "userId")
            .areaCode(EnumSet.of(RtmConstants.RtmAreaCode.AS, RtmConstants.RtmAreaCode.CN))
            .eventListener(eventListener)
            .build()
        ```
      </CodeBlockTab>
    </CodeBlockTabs>

    ## Reference [#reference-1]

    This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

    ### API reference [#api-reference-1]

    * [`RtmConfig`](/en/api-reference/api-ref/signaling#configrtmpropsag_platform)
    * [`RtmClient.create`](/en/api-reference/api-ref/signaling#configcreatepropsag_platform)

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="ios">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="ios" />

    To comply with local laws and regulations, you can restrict user connections to specific geographic zones. Agora enables you to control data routing in your app by specifying the Agora SDRTN® zones that users can connect to.

    ## Understand the tech [#understand-the-tech-2]

    When you set area codes in your client configuration, the SDK only accesses the Agora server in the specified zone(s), irrespective of the geographical location of the user.

    The following zones are available:

    * **GLOB**: Global (Default)
    * **NA**: North America
    * **CN**: Mainland China.
    * **AS**: Asia excluding mainland China.
    * **EU**: Europe
    * **IN**: India
    * **JP**: Japan

    ## Prerequisites [#prerequisites-2]

    Ensure that you have implemented the [SDK quickstart](/en/realtime-media/rtm/quickstart) in your project.

    ## Configure geographical zones [#configure-geographical-zones-2]

    To configure geographical access, specify area codes in the configuration when you initialize a Signaling client instance. You can combine the codes to include or exclude specific zones.

    <CodeBlockTabs defaultValue="Swift">
      <CodeBlockTabsList>
        <CodeBlockTabsTrigger value="Swift">
          Swift
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="Objective-C">
          Objective-C
        </CodeBlockTabsTrigger>
      </CodeBlockTabsList>

      <CodeBlockTab value="Swift">
        ```swift
        {`let config = AgoraRtmClientConfig(appId: "<your_app_id>", userId: "<your_user_id>")
        config.areaCode = [.CN, .NA]`}
        ```
      </CodeBlockTab>

      <CodeBlockTab value="Objective-C">
        ```cpp
        {`AgoraRtmClientConfig *rtm_cfg = [[AgoraRtmClientConfig alloc] initWithAppId:@"<your_app_id>" userId:@"<your_user_id>"];
        rtm_cfg.areaCode = AgoraRtmAreaCodeNA;`}
        ```
      </CodeBlockTab>
    </CodeBlockTabs>

    ## Reference [#reference-2]

    This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

    ### API reference [#api-reference-2]

    <Tabs defaultValue="swift" groupId="language">
      <TabsList>
        <TabsTrigger value="swift">
          Swift
        </TabsTrigger>

        <TabsTrigger value="objc">
          Objective-C
        </TabsTrigger>
      </TabsList>

      <TabsContent value="swift">
        * [`AgoraRtmClientConfig`](/en/api-reference/api-ref/signaling?platform=ios\&tab=swift#configrtmpropsag_platform)
        * [Initialize](/en/api-reference/api-ref/signaling?platform=ios\&tab=swift#create-an-instance)
      </TabsContent>

      <TabsContent value="objc">
        * [`AgoraRtmClientConfig`](/en/api-reference/api-ref/signaling?platform=ios\&tab=objc#configrtmpropsag_platform)
        * [`initWithConfig`](/en/api-reference/api-ref/signaling?platform=ios\&tab=objc#create-an-instance)
      </TabsContent>
    </Tabs>

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="macos">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="macos" />

    To comply with local laws and regulations, you can restrict user connections to specific geographic zones. Agora enables you to control data routing in your app by specifying the Agora SDRTN® zones that users can connect to.

    ## Understand the tech [#understand-the-tech-3]

    When you set area codes in your client configuration, the SDK only accesses the Agora server in the specified zone(s), irrespective of the geographical location of the user.

    The following zones are available:

    * **GLOB**: Global (Default)
    * **NA**: North America
    * **CN**: Mainland China.
    * **AS**: Asia excluding mainland China.
    * **EU**: Europe
    * **IN**: India
    * **JP**: Japan

    ## Prerequisites [#prerequisites-3]

    Ensure that you have implemented the [SDK quickstart](/en/realtime-media/rtm/quickstart) in your project.

    ## Configure geographical zones [#configure-geographical-zones-3]

    To configure geographical access, specify area codes in the configuration when you initialize a Signaling client instance. You can combine the codes to include or exclude specific zones.

    <CodeBlockTabs defaultValue="Swift">
      <CodeBlockTabsList>
        <CodeBlockTabsTrigger value="Swift">
          Swift
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="Objective-C">
          Objective-C
        </CodeBlockTabsTrigger>
      </CodeBlockTabsList>

      <CodeBlockTab value="Swift">
        ```swift
        {`let config = AgoraRtmClientConfig(appId: "<your_app_id>", userId: "<your_user_id>")
        config.areaCode = [.CN, .NA]`}
        ```
      </CodeBlockTab>

      <CodeBlockTab value="Objective-C">
        ```cpp
        {`AgoraRtmClientConfig *rtm_cfg = [[AgoraRtmClientConfig alloc] initWithAppId:@"<your_app_id>" userId:@"<your_user_id>"];
        rtm_cfg.areaCode = AgoraRtmAreaCodeNA;`}
        ```
      </CodeBlockTab>
    </CodeBlockTabs>

    ## Reference [#reference-3]

    This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

    ### API reference [#api-reference-3]

    <Tabs defaultValue="swift" groupId="language">
      <TabsList>
        <TabsTrigger value="swift">
          Swift
        </TabsTrigger>

        <TabsTrigger value="objc">
          Objective-C
        </TabsTrigger>
      </TabsList>

      <TabsContent value="swift">
        * [`AgoraRtmClientConfig`](/en/api-reference/api-ref/signaling?platform=ios\&tab=swift#configrtmpropsag_platform)
        * [Initialize](/en/api-reference/api-ref/signaling?platform=ios\&tab=swift#create-an-instance)
      </TabsContent>

      <TabsContent value="objc">
        * [`AgoraRtmClientConfig`](/en/api-reference/api-ref/signaling?platform=ios\&tab=objc#configrtmpropsag_platform)
        * [`initWithConfig`](/en/api-reference/api-ref/signaling?platform=ios\&tab=objc#create-an-instance)
      </TabsContent>
    </Tabs>

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="flutter">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="flutter" />

    To comply with local laws and regulations, you can restrict user connections to specific geographic zones. Agora enables you to control data routing in your app by specifying the Agora SDRTN® zones that users can connect to.

    ## Understand the tech [#understand-the-tech-4]

    When you set area codes in your client configuration, the SDK only accesses the Agora server in the specified zone(s), irrespective of the geographical location of the user.

    The following zones are available:

    * **GLOB**: Global (Default)
    * **NA**: North America
    * **CN**: Mainland China.
    * **AS**: Asia excluding mainland China.
    * **EU**: Europe
    * **IN**: India
    * **JP**: Japan

    ## Prerequisites [#prerequisites-4]

    Ensure that you have implemented the [SDK quickstart](/en/realtime-media/rtm/quickstart) in your project.

    ## Configure geographical zones [#configure-geographical-zones-4]

    To configure geographical access, specify area codes in the configuration when you initialize a Signaling client instance. You can combine the codes to include or exclude specific zones.

    ```dart
    // Create a Set containing specific RtmAreaCode values
    Set<RtmAreaCode> areaCodes = {RtmAreaCode.na, RtmAreaCode.eu};

    // Use the areaCodes in RtmConfig
    RtmConfig config = RtmConfig(
      areaCode: areaCodes
    );
    ```

    ## Reference [#reference-4]

    This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

    ### API reference [#api-reference-4]

    * [`RtmConfig`](/en/api-reference/api-ref/signaling#configrtmpropsag_platform)
    * [`RTM()`](/en/api-reference/api-ref/signaling#initialization)

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="react-native">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="react-native" />

    To comply with local laws and regulations, you can restrict user connections to specific geographic zones. Agora enables you to control data routing in your app by specifying the Agora SDRTN® zones that users can connect to.

    ## Understand the tech [#understand-the-tech-5]

    When you set area codes in your client configuration, the SDK only accesses the Agora server in the specified zone(s), irrespective of the geographical location of the user.

    The following zones are available:

    * **GLOB**: Global (Default)
    * **NA**: North America
    * **CN**: Mainland China.
    * **AS**: Asia excluding mainland China.
    * **EU**: Europe
    * **IN**: India
    * **JP**: Japan

    ## Prerequisites [#prerequisites-5]

    Ensure that you have implemented the [SDK quickstart](/en/realtime-media/rtm/quickstart) in your project.

    ## Configure geographical zones [#configure-geographical-zones-5]

    To configure geographical access, specify area codes in the configuration when you initialize a Signaling client instance. You can combine the codes to include or exclude specific zones.

    ```ts

    const client = createAgoraRtmClient(
     new RtmConfig({
       userId: '<your_user_id>',
       appId: '<your_app_id>',
       useStringUserId: true,
       areaCode: RtmAreaCode.as | RtmAreaCode.cn, // Multiple areas using bitwise OR
       // Or use a single area:
       // areaCode: RtmAreaCode.as,
     })
    );
    ```

    ## Reference [#reference-5]

    This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

    ### API reference [#api-reference-5]

    * [`createAgoraRtmClient`](https://api-ref.agora.io/en/signaling-sdk/react-native/2.x#createagorartmclient)

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="windows">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="windows" />

    To comply with local laws and regulations, you can restrict user connections to specific geographic zones. Agora enables you to control data routing in your app by specifying the Agora SDRTN® zones that users can connect to.

    ## Understand the tech [#understand-the-tech-6]

    When you set area codes in your client configuration, the SDK only accesses the Agora server in the specified zone(s), irrespective of the geographical location of the user.

    The following zones are available:

    * **GLOB**: Global (Default)
    * **NA**: North America
    * **CN**: Mainland China.
    * **AS**: Asia excluding mainland China.
    * **EU**: Europe
    * **IN**: India
    * **JP**: Japan

    ## Prerequisites [#prerequisites-6]

    Ensure that you have implemented the [SDK quickstart](/en/realtime-media/rtm/quickstart) in your project.

    ## Configure geographical zones [#configure-geographical-zones-6]

    To configure geographical access, specify area codes in the configuration when you initialize a Signaling client instance. You can combine the codes to include or exclude specific zones.

    ```cpp
    rtmConfig.areaCode = RTM_AREA_CODE_NA;
    int ret = signalingEngine->initialize(rtmConfig);
    ```

    ## Reference [#reference-6]

    This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

    ### API reference [#api-reference-6]

    * [`createAgoraRtmClient`](/en/api-reference/api-ref/signaling#configcreatepropsag_platform)
    * [`RtmConfig`](/en/api-reference/api-ref/signaling#configrtmpropsag_platform)

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="linux-cpp">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="linux-cpp" />

    To comply with local laws and regulations, you can restrict user connections to specific geographic zones. Agora enables you to control data routing in your app by specifying the Agora SDRTN® zones that users can connect to.

    ## Understand the tech [#understand-the-tech-7]

    When you set area codes in your client configuration, the SDK only accesses the Agora server in the specified zone(s), irrespective of the geographical location of the user.

    The following zones are available:

    * **GLOB**: Global (Default)
    * **NA**: North America
    * **CN**: Mainland China.
    * **AS**: Asia excluding mainland China.
    * **EU**: Europe
    * **IN**: India
    * **JP**: Japan

    ## Prerequisites [#prerequisites-7]

    Ensure that you have implemented the [SDK quickstart](/en/realtime-media/rtm/quickstart) in your project.

    ## Configure geographical zones [#configure-geographical-zones-7]

    To configure geographical access, specify area codes in the configuration when you initialize a Signaling client instance. You can combine the codes to include or exclude specific zones.

    ```cpp
    rtmConfig.areaCode = RTM_AREA_CODE_NA;
    int ret = signalingEngine->initialize(rtmConfig);
    ```

    ## Reference [#reference-7]

    This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

    ### API reference [#api-reference-7]

    * [`createAgoraRtmClient`](/en/api-reference/api-ref/signaling#configcreatepropsag_platform)
    * [`RtmConfig`](/en/api-reference/api-ref/signaling#configrtmpropsag_platform)

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>

  <_PlatformPanel platform="unity">
    <_PlatformProcessedMarker groupMode="structured" canonicalPlatform="web" platform="unity" />

    To comply with local laws and regulations, you can restrict user connections to specific geographic zones. Agora enables you to control data routing in your app by specifying the Agora SDRTN® zones that users can connect to.

    ## Understand the tech [#understand-the-tech-8]

    When you set area codes in your client configuration, the SDK only accesses the Agora server in the specified zone(s), irrespective of the geographical location of the user.

    The following zones are available:

    * **GLOB**: Global (Default)
    * **NA**: North America
    * **CN**: Mainland China.
    * **AS**: Asia excluding mainland China.
    * **EU**: Europe
    * **IN**: India
    * **JP**: Japan

    ## Prerequisites [#prerequisites-8]

    Ensure that you have implemented the [SDK quickstart](/en/realtime-media/rtm/quickstart) in your project.

    ## Configure geographical zones [#configure-geographical-zones-8]

    To configure geographical access, specify area codes in the configuration when you initialize a Signaling client instance. You can combine the codes to include or exclude specific zones.

    ```cpp
    rtmConfig.areaCode = Agora.Rtm.RTM_AREA_CODE.NA;
    ```

    ## Reference [#reference-8]

    This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

    ### API reference [#api-reference-8]

    * [`RtmConfig`](/en/api-reference/api-ref/signaling#configrtmpropsag_platform)
    * [`CreateAgoraRtmClient`](/en/api-reference/api-ref/signaling#configcreatepropsag_platform)

    <_PlatformProcessedMarker close="true" />
  </_PlatformPanel>
</_PlatformTabsGroup>
