Geofencing
Feature Overview
Geofencing refers to limiting the transmission of audio, video, and signaling data to a certain 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 region actually accessed by the SDK will be Europe.
| Specified Geofencing Region | App User Region | SDK Actual 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 App user's region, poor public internet network quality will affect the audio and video experience.
Currently, the SDK supports the following regions:
If you need to support more regions, please contact ZEGOCLOUD Technical Support.
| Region | Enum |
|---|---|
| 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 applied for a valid AppID and AppSign. For details, please refer to Console - Project Information.
- You have integrated the ZEGO Express SDK in your project and implemented basic audio and video streaming functionality. For details, please refer to Quick Start - Integration and Quick Start - Implementation.
Implementation Process
Open geofencing permission
Geofencing capability may require payment in some cases. Please contact ZEGO business to confirm and open geofencing permission.
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 in the geofence.
- Exclude: Indicates that all regions in the region list are excluded from the geofence.
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
ZegoGeoFenceType geofence_type = ZegoGeoFenceType.INCLUDE;//Set Include mode
List<Integer> geofence_area_list = new ArrayList<>(); // Set region list information, set at least 1, maximum set not greater than the number supported by the SDK
geofence_area_list.add(2);// ZegoGeoFenceAreaCode.CN
geofence_area_list.add(3);// ZegoGeoFenceAreaCode.NA
ZegoExpressEngine.setGeoFence(geofence_type, geofence_area_list);// This interface is a static method, called before createEngine
// Example of setting Exclude mode
ZegoGeoFenceType geofence_type = ZegoGeoFenceType.EXCLUDE;//Set Exclude mode
List<Integer> geofence_area_list = new ArrayList<>();// Set region list information, set at least 1, maximum set not greater than or equal to the number supported by the SDK
geofence_area_list.add(2);// ZegoGeoFenceAreaCode.CN
geofence_area_list.add(3);// ZegoGeoFenceAreaCode.NA
ZegoExpressEngine.setGeoFence(geofence_type, geofence_area_list);// This interface is a static method, called before createEngineIntegrate other features
After completing the geofencing settings, you can proceed with other feature integration.
