Geofencing
Overview
Geofencing refers to restricting the transmission of audio, video, and signaling data to a specific region to comply with 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 users are located, the actual region accessed by the SDK will be Europe.
| Specified geofencing region | App user region | Actual SDK access 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 cross-regional public internet between the specified geofencing region and the region where App users are located, poor public internet network quality will affect the audio and video experience.
Currently the SDK supports configuring the following regions:
For support for more regions, please contact ZEGOCLOUD 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, please ensure:
- You have created a project in the ZEGOCLOUD Console and obtained a valid AppID and AppSign. For details, please refer to Console - Project Information.
- You have integrated the ZEGO Express SDK into your project and implemented basic audio and video publishing and playing functions. For details, please refer to Quick Start - Integration and Quick Start - Implementation.
Implementation Process
Activate geofencing permission
Geofencing capability may require payment in some cases. Please contact ZEGO business personnel to confirm and activate geofencing permissions.
Set geofencing
- Geofencing information: Includes geofencing type and geofencing region list.
- Geofencing type: Includes two types: Include and Exclude. The geofencing type will apply to 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 createEngineWithProfile, otherwise it will be invalid.
// Example of setting Include mode
var geofence_type = ZegoGeoFenceType.Include;// Set Include mode
var geofence_area_list = <int>[]; // Set region list information, set at least 1, at most not greater than the number supported by the SDK
geofence_area_list.add(ZegoGeoFenceAreaCode.CN);// ZegoGeoFenceAreaCode.CN
geofence_area_list.add(ZegoGeoFenceAreaCode.NA);// ZegoGeoFenceAreaCode.NA
ZegoExpressEngine.setGeoFence(geofence_type, geofence_area_list);// This interface is a static method, called before createEngineWithProfile
// Example of setting Exclude mode
var geofence_type = ZegoGeoFenceType.Exclude;// Set Exclude mode
var geofence_area_list = <int>[];// Set region list information, set at least 1, at most not greater than or equal to the number supported by the SDK
geofence_area_list.add(ZegoGeoFenceAreaCode.CN);// ZegoGeoFenceAreaCode.CN
geofence_area_list.add(ZegoGeoFenceAreaCode.NA);// ZegoGeoFenceAreaCode.NA
ZegoExpressEngine.setGeoFence(geofence_type, geofence_area_list);// This interface is a static method, called before createEngineWithProfileIntegrate other features
After completing the geofencing settings, you can proceed with integrating other features.
