Geofencing
Introduction
Geofencing refers to limiting the transmission of audio, video, and signaling data to a certain region to meet regional data privacy and security regulations, that is, limiting access to audio and video services in a specific region. For example, when the specified geofencing region is Europe, regardless of where the App user is located, the region actually accessed by the SDK will be Europe.
| Specified Geofencing Region | App User Location | SDK Actually Accessed Region | User Experience After Connection |
|---|---|---|---|
| Europe | Europe | Europe | Normal |
| Europe | China | Europe | May be significantly affected |
- If all servers in the specified geofencing region are unavailable, the SDK will directly report an error.
- Since there is a cross-region public Internet between the specified geofencing region and the App user's location, poor public Internet network quality will affect the audio and video experience.
Currently, the SDK supports the following configured regions:
If you need to support more regions, please contact ZEGO Technical Support.
| Region | Enumeration |
|---|---|
| Mainland China, excluding Hong Kong, Macao, and Taiwan | CN |
| North America | NA |
| India | IN |
| Europe | EU |
| Asia, excluding Mainland China and India | AS |
Prerequisites
Before using the geofencing feature, ensure that:
- A project has been created in the ZEGOCLOUD Console, and valid AppID and AppSign have been obtained. For details, please refer to Console - Project Information.
- ZEGO Express SDK has been integrated into the project, and basic audio and video streaming functionality has been implemented. For details, please refer to Quick Start - Integration and Quick Start - Implementation Process.
Implementation Process
1 Open geofencing permission
Geofencing capability may require charges in some cases. Please contact ZEGO business to confirm and open geofencing permission.
2 Set geofencing
- Geofencing information: Includes geofencing type and geofencing region list.
- Geofencing type: Includes two types: Include and Exclude. The geofencing type will act on the geofencing region list.
- Include: Indicates that all regions in the region list are included within the geofencing.
- Exclude: Indicates that all regions in the region list are excluded from the geofencing.
Before creating the SDK, call the setGeoFence interface to set geofencing information.
Please configure geofencing information before calling createEngine, otherwise it will be invalid.
// Example of setting Include mode
//Set Include mode
ZegoGeoFenceType type = ZegoGeoFenceType::ZEGO_GEO_FENCE_TYPE_INCLUDE;
// Set region list information, at least 1, at most not more than the number supported by the SDK
std::vector<int> areaList;
areaList.push_back((int)ZegoGeoFenceAreaCode::ZEGO_GEO_FENCE_AREA_CODE_CN);
areaList.push_back((int)ZegoGeoFenceAreaCode::ZEGO_GEO_FENCE_AREA_CODE_NA);
// This interface is a static method, called before createEngine
ZegoExpressSDK::setGeoFence(type, areaList);
// Example of setting Exclude mode
//Set Exclude mode
ZegoGeoFenceType type = ZegoGeoFenceType::ZEGO_GEO_FENCE_TYPE_EXCLUDE;
// Set region list information, at least 1, at most not more than the number supported by the SDK
std::vector<int> areaList;
areaList.push_back((int)ZegoGeoFenceAreaCode::ZEGO_GEO_FENCE_AREA_CODE_CN);
areaList.push_back((int)ZegoGeoFenceAreaCode::ZEGO_GEO_FENCE_AREA_CODE_NA);
// This interface is a static method, called before createEngine
ZegoExpressSDK::setGeoFence(type, areaList);3 Access other features
After completing the geofencing settings, you can proceed to access other features.
